db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fuzzylo...@apache.org
Subject svn commit: r390000 - /db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
Date Thu, 30 Mar 2006 05:47:38 GMT
Author: fuzzylogic
Date: Wed Mar 29 21:47:37 2006
New Revision: 390000

URL: http://svn.apache.org/viewcvs?rev=390000&view=rev
Log:
DERBY-622 (partial): Add privileged blocks for calls to getResourceAsStream()
in impl.tools.sysinfo.Main.

Committed for Myrna Van Lunteren <m.v.lunteren@gmail.com>

Modified:
    db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java

Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java?rev=390000&r1=389999&r2=390000&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java Wed Mar 29
21:47:37 2006
@@ -20,6 +20,8 @@
 
 package org.apache.derby.impl.tools.sysinfo;
 
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.Locale;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
@@ -364,11 +366,23 @@
 
       String localeResource =
          "/org/apache/derby/info/locale_" + stringLocales[i] + ".properties";
-
-      try {
-
-        InputStream is = p.getClass().getResourceAsStream (localeResource);
-
+      
+      final Properties finalp = p;
+      final String finalLocaleResource = localeResource;
+     
+      try {     
+        	InputStream is = (InputStream) AccessController.doPrivileged
+            (new PrivilegedAction() {
+                  public Object run() {
+  		            InputStream locis =
+  		            	finalp.getClass().getResourceAsStream (finalLocaleResource);
+  					return locis;
+                  }
+              }
+           );      
+      	
+      	
+      	
         if (is == null) {
 //           localAW.println("resource is null: " + localeResource);
         }
@@ -751,9 +765,18 @@
 
         for (int i = 0; i < infoNames.length; i++)
         {
-			String resource = "/".concat(infoNames[i]);
+            final String resource = "/".concat(infoNames[i]);
+
+            InputStream is = (InputStream) AccessController.doPrivileged
+            (new PrivilegedAction() {
+                public Object run() {
+			        InputStream locis =
+                        new Main().getClass().getResourceAsStream(resource);
+                            return locis;
+                    }
+                }
+            );         
 
-            InputStream is = new Main().getClass().getResourceAsStream(resource);
 			if (is == null)
 				continue;
 



Mime
View raw message