commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r227044 - in /jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery: jdk/JDK11Hooks.java jdk/JDK12Hooks.java jdk/JDKHooks.java tools/ManagedProperties.java
Date Tue, 02 Aug 2005 17:04:29 GMT
Author: dims
Date: Tue Aug  2 10:04:25 2005
New Revision: 227044

URL: http://svn.apache.org/viewcvs?rev=227044&view=rev
Log:
- Adding getSystemProperty in JDKHooks for handling SecurityException
- Handle one more SecurityException in classLoader.getParent()


Modified:
    jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
    jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
    jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
    jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java

Modified: jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java?rev=227044&r1=227043&r2=227044&view=diff
==============================================================================
--- jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
(original)
+++ jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK11Hooks.java
Tue Aug  2 10:04:25 2005
@@ -27,6 +27,15 @@
     private static final ClassLoader systemClassLoader
         = new PsuedoSystemClassLoader();
 
+    /**
+     * Get the system property
+     *
+     * @param propName name of the property
+     * @return value of the property
+     */
+    public String getSystemProperty(final String propName) {
+        return System.getProperty(propName);
+    }
 
     /**
      * The thread context class loader is available for JDK 1.2

Modified: jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java?rev=227044&r1=227043&r2=227044&view=diff
==============================================================================
--- jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
(original)
+++ jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDK12Hooks.java
Tue Aug  2 10:04:25 2005
@@ -46,6 +46,25 @@
     }
     
     /**
+     * Get the system property
+     *
+     * @param propName name of the property
+     * @return value of the property
+     */
+    public String getSystemProperty(final String propName) {
+        return (String)
+        java.security.AccessController.doPrivileged(new java.security.PrivilegedAction()
{
+            public Object run() {
+                try {
+                    return System.getProperty(propName);
+                } catch (SecurityException se){
+                    return null;
+                }
+            }
+        });
+    }
+
+    /**
      * The thread context class loader is available for JDK 1.2
      * or later, if certain security conditions are met.
      * 

Modified: jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java?rev=227044&r1=227043&r2=227044&view=diff
==============================================================================
--- jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
(original)
+++ jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/jdk/JDKHooks.java
Tue Aug  2 10:04:25 2005
@@ -41,6 +41,14 @@
     }
 
     /**
+     * Get the system property
+     *
+     * @param propName name of the property
+     * @return value of the property
+     */
+    public abstract String getSystemProperty(final String propName);
+
+    /**
      * The thread context class loader is available for JDK 1.2
      * or later, if certain security conditions are met.
      * 

Modified: jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java?rev=227044&r1=227043&r2=227044&view=diff
==============================================================================
--- jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
(original)
+++ jakarta/commons/proper/discovery/trunk/src/java/org/apache/commons/discovery/tools/ManagedProperties.java
Tue Aug  2 10:04:25 2005
@@ -121,7 +121,7 @@
      * @return property value if found, otherwise default.
      */
     public static String getProperty(ClassLoader classLoader, String propertyName) {
-        String value = System.getProperty(propertyName);
+        String value = JDKHooks.getJDKHooks().getSystemProperty(propertyName);
         if (value == null) {
             Value val = getValueProperty(classLoader, propertyName);
             if (val != null) {
@@ -348,7 +348,11 @@
     private static final ClassLoader getParent(final ClassLoader classLoader) {
         return (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
                     public Object run() {
-                        return classLoader.getParent();
+                        try {
+                            return classLoader.getParent();
+                        } catch (SecurityException se){
+                            return null;
+                        }
                     }
                 });
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message