You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by mr...@apache.org on 2011/12/29 03:38:32 UTC

svn commit: r1225414 [1/2] - in /xalan/java/trunk/src/org/apache: xalan/extensions/ xalan/lib/ xalan/lib/sql/ xalan/xslt/ xalan/xsltc/cmdline/ xalan/xsltc/compiler/ xalan/xsltc/compiler/util/ xalan/xsltc/dom/ xalan/xsltc/runtime/ xalan/xsltc/trax/ xml/...

Author: mrglavas
Date: Thu Dec 29 02:38:30 2011
New Revision: 1225414

URL: http://svn.apache.org/viewvc?rev=1225414&view=rev
Log:
Cleaning up SecuritySupport. We no longer need both SecuritySupport and SecuritySupport12 because Xalan now only compiles and runs on J2SE 1.3 or higher. This allows us to tighten up this class even more.

Added:
    xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport.java
      - copied, changed from r1225326, xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport12.java
Removed:
    xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport12.java
    xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport12.java
Modified:
    xalan/java/trunk/src/org/apache/xalan/extensions/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/lib/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/lib/sql/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/xslt/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/dom/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xalan/xsltc/trax/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xml/dtm/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xml/dtm/ref/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java
    xalan/java/trunk/src/org/apache/xml/serializer/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java
    xalan/java/trunk/src/org/apache/xml/utils/ObjectFactory.java
    xalan/java/trunk/src/org/apache/xpath/functions/FuncSystemProperty.java
    xalan/java/trunk/src/org/apache/xpath/functions/ObjectFactory.java

Modified: xalan/java/trunk/src/org/apache/xalan/extensions/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/extensions/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/extensions/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/extensions/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/extensions/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/lib/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/lib/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/lib/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/lib/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/lib/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/lib/sql/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/lib/sql/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/lib/sql/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/lib/sql/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/lib/sql/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/xslt/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xslt/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xslt/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xslt/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xslt/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/cmdline/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/compiler/util/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/dom/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/dom/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/dom/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/dom/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 

Copied: xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/dom/SecuritySupport.java Thu Dec 29 02:38:30 2011
@@ -37,9 +37,9 @@ import java.security.PrivilegedException
  *
  * Security related methods that only work on J2SE 1.2 and newer.
  */
-class SecuritySupport12 extends SecuritySupport {
+final class SecuritySupport {
 
-    ClassLoader getContextClassLoader() {
+    static ClassLoader getContextClassLoader() {
         return (ClassLoader)
                 AccessController.doPrivileged(new PrivilegedAction() {
             public Object run() {
@@ -52,7 +52,7 @@ class SecuritySupport12 extends Security
         });
     }
 
-    ClassLoader getSystemClassLoader() {
+    static ClassLoader getSystemClassLoader() {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -65,7 +65,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    ClassLoader getParentClassLoader(final ClassLoader cl) {
+    static ClassLoader getParentClassLoader(final ClassLoader cl) {
         return (ClassLoader)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -81,7 +81,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    String getSystemProperty(final String propName) {
+    static String getSystemProperty(final String propName) {
         return (String)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -90,7 +90,7 @@ class SecuritySupport12 extends Security
             });
     }
 
-    FileInputStream getFileInputStream(final File file)
+    static FileInputStream getFileInputStream(final File file)
         throws FileNotFoundException
     {
         try {
@@ -105,7 +105,7 @@ class SecuritySupport12 extends Security
         }
     }
 
-    InputStream getResourceAsStream(final ClassLoader cl,
+    static InputStream getResourceAsStream(final ClassLoader cl,
                                            final String name)
     {
         return (InputStream)
@@ -122,7 +122,7 @@ class SecuritySupport12 extends Security
             });
     }
     
-    boolean getFileExists(final File f) {
+    static boolean getFileExists(final File f) {
     return ((Boolean)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -131,7 +131,7 @@ class SecuritySupport12 extends Security
             })).booleanValue();
     }
     
-    long getLastModified(final File f) {
+    static long getLastModified(final File f) {
     return ((Long)
             AccessController.doPrivileged(new PrivilegedAction() {
                 public Object run() {
@@ -139,5 +139,6 @@ class SecuritySupport12 extends Security
                 }
             })).longValue();
     }
-        
+    
+    private SecuritySupport () {}
 }

Modified: xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -258,11 +258,9 @@ class ObjectFactory {
                                                 String propertiesFilename,
                                                 String fallbackClassName)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Use the system property first
         try {
-            String systemProp = ss.getSystemProperty(factoryId);
+            String systemProp = SecuritySupport.getSystemProperty(factoryId);
             if (systemProp != null) {
                 debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
@@ -280,11 +278,11 @@ class ObjectFactory {
             File propertiesFile = null;
             boolean propertiesFileExists = false;
             try {
-                String javah = ss.getSystemProperty("java.home");
+                String javah = SecuritySupport.getSystemProperty("java.home");
                 propertiesFilename = javah + File.separator +
                     "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
                 propertiesFile = new File(propertiesFilename);
-                propertiesFileExists = ss.getFileExists(propertiesFile);
+                propertiesFileExists = SecuritySupport.getFileExists(propertiesFile);
             } catch (SecurityException e) {
                 // try again...
                 fLastModified = -1;
@@ -298,7 +296,7 @@ class ObjectFactory {
                     // file existed last time
                     if(fLastModified >= 0) {
                         if(propertiesFileExists &&
-                                (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
+                                (fLastModified < (fLastModified = SecuritySupport.getLastModified(propertiesFile)))) {
                             loadProperties = true;
                         } else {
                             // file has stopped existing...
@@ -311,14 +309,14 @@ class ObjectFactory {
                         // file has started to exist:
                         if(propertiesFileExists) {
                             loadProperties = true;
-                            fLastModified = ss.getLastModified(propertiesFile);
+                            fLastModified = SecuritySupport.getLastModified(propertiesFile);
                         } // else, nothing's changed
                     }
                     if(loadProperties) {
                         // must never have attempted to read xalan.properties
                         // before (or it's outdeated)
                         fXalanProperties = new Properties();
-                        fis = ss.getFileInputStream(propertiesFile);
+                        fis = SecuritySupport.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
 	        } catch (Exception x) {
@@ -345,7 +343,7 @@ class ObjectFactory {
         } else {
             FileInputStream fis = null;
             try {
-                fis = ss.getFileInputStream(new File(propertiesFilename));
+                fis = SecuritySupport.getFileInputStream(new File(propertiesFilename));
                 Properties props = new Properties();
                 props.load(fis);
                 factoryClassName = props.getProperty(factoryId);
@@ -393,12 +391,10 @@ class ObjectFactory {
     static ClassLoader findClassLoader()
         throws ConfigurationError
     { 
-        SecuritySupport ss = SecuritySupport.getInstance();
-
         // Figure out which ClassLoader to use for loading the provider
         // class.  If there is a Context ClassLoader then use it.
-        ClassLoader context = ss.getContextClassLoader();
-        ClassLoader system = ss.getSystemClassLoader();
+        ClassLoader context = SecuritySupport.getContextClassLoader();
+        ClassLoader system = SecuritySupport.getSystemClassLoader();
 
         ClassLoader chain = system;
         while (true) {
@@ -423,7 +419,7 @@ class ObjectFactory {
                     if (chain == null) {
                         break;
                     }
-                    chain = ss.getParentClassLoader(chain);
+                    chain = SecuritySupport.getParentClassLoader(chain);
                 }
 
                 // Assert: Current ClassLoader not in chain of
@@ -438,7 +434,7 @@ class ObjectFactory {
 
             // Check for any extension ClassLoaders in chain up to
             // boot ClassLoader
-            chain = ss.getParentClassLoader(chain);
+            chain = SecuritySupport.getParentClassLoader(chain);
         };
 
         // Assert: Context ClassLoader not in chain of
@@ -534,21 +530,20 @@ class ObjectFactory {
      */
     private static String findJarServiceProviderName(String factoryId)
     {
-        SecuritySupport ss = SecuritySupport.getInstance();
         String serviceId = SERVICES_PATH + factoryId;
         InputStream is = null;
 
         // First try the Context ClassLoader
         ClassLoader cl = findClassLoader();
 
-        is = ss.getResourceAsStream(cl, serviceId);
+        is = SecuritySupport.getResourceAsStream(cl, serviceId);
 
         // If no provider found then try the current ClassLoader
         if (is == null) {
             ClassLoader current = ObjectFactory.class.getClassLoader();
             if (cl != current) {
                 cl = current;
-                is = ss.getResourceAsStream(cl, serviceId);
+                is = SecuritySupport.getResourceAsStream(cl, serviceId);
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org