db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r348532 - in /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n: DefaultLocale.java messageLocale_app.properties urlLocale_app.properties
Date Wed, 23 Nov 2005 19:51:21 GMT
Author: djd
Date: Wed Nov 23 11:51:19 2005
New Revision: 348532

URL: http://svn.apache.org/viewcvs?rev=348532&view=rev
Log:
DERBY-615 Enable i18n tests messageLocale.sql and urlLocale.sql under the security manager.

Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/messageLocale_app.properties
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/urlLocale_app.properties

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java?rev=348532&r1=348531&r2=348532&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/DefaultLocale.java
Wed Nov 23 11:51:19 2005
@@ -22,6 +22,8 @@
 
 import java.util.Locale;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.sql.DriverManager;
 import java.sql.Connection;
 import java.sql.SQLException;
@@ -32,14 +34,13 @@
 
 	static {
 		savedLocale=java.util.Locale.getDefault().toString();
-		Locale.setDefault(new Locale("rr", "TT"));
+		setDefaultLocale("rr", "TT");
 	}
 
 
 	// used in messageLocale test
 	public static void checkDefaultLocale() throws SQLException
 	{
-		Connection conn = DriverManager.getConnection("jdbc:default:connection");
 		String defLocale = java.util.Locale.getDefault().toString();
 		//System.out.println(defLocale);
 		if (!defLocale.equals("rr_TT"))
@@ -49,7 +50,6 @@
 	// used in urlLocale test
 	public static void checkRDefaultLocale() throws SQLException
 	{
-		Connection conn = DriverManager.getConnection("jdbc:default:connection");
 		System.out.println(savedLocale);
 		if (!savedLocale.equals("en_US"))
 			throw new SQLException("wrong_locale");
@@ -67,10 +67,19 @@
 	}
 
 	// used in messageLocale test
-	public static void setDefaultLocale(String Locale, String Code) throws SQLException
+	public static void setDefaultLocale(final String Locale, final String Code)
 	{
-		Connection conn = DriverManager.getConnection("jdbc:default:connection");
-		java.util.Locale.setDefault(new java.util.Locale(Locale.trim(),Code.trim()));
+		// needs to run in a privileged block as it will be
+		// called through a SQL statement and thus a generated
+		// class. The generated class on the stack has no permissions
+		// granted to it. Needs write permission on user.language
+		AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+            	java.util.Locale.setDefault(new java.util.Locale(Locale.trim(),Code.trim()));
+                return null; // nothing to return
+            }
+        });		
+		
 	}
 
 

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/messageLocale_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/messageLocale_app.properties?rev=348532&r1=348531&r2=348532&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/messageLocale_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/messageLocale_app.properties
Wed Nov 23 11:51:19 2005
@@ -8,6 +8,3 @@
 #Exclude for J2ME/Foundation - test requires java.sql.Driver
 runwithfoundation=false
 
-# disable security manager for now - need investigation
-noSecurityManager=true
-

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/urlLocale_app.properties
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/urlLocale_app.properties?rev=348532&r1=348531&r2=348532&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/urlLocale_app.properties
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/i18n/urlLocale_app.properties
Wed Nov 23 11:51:19 2005
@@ -3,7 +3,5 @@
 
 usedefaults=true
 
-# disable security manager for now - need investigation
-noSecurityManager=true
 
 



Mime
View raw message