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 [2/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/...
Copied: xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/runtime/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/trax/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/trax/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/trax/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/trax/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/trax/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xalan/xsltc/trax/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xalan/xsltc/trax/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/xml/dtm/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/dtm/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/dtm/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xml/dtm/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/xml/dtm/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/dtm/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xml/dtm/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/xml/dtm/ref/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/dtm/ref/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/dtm/ref/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xml/dtm/ref/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/xml/dtm/ref/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/dtm/ref/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xml/dtm/ref/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/xml/serializer/Encodings.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/Encodings.java Thu Dec 29 02:38:30 2011
@@ -314,10 +314,8 @@ public final class Encodings extends Obj
{
try
{
- final InputStream is;
-
- SecuritySupport ss = SecuritySupport.getInstance();
- is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
+ final InputStream is;
+ is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
ENCODINGS_FILE);
Properties props = new Properties();
Modified: xalan/java/trunk/src/org/apache/xml/serializer/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/serializer/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/ObjectFactory.java Thu Dec 29 02:38:30 2011
@@ -257,11 +257,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;
@@ -279,11 +277,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;
@@ -297,7 +295,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...
@@ -310,14 +308,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) {
@@ -344,7 +342,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);
@@ -392,12 +390,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) {
@@ -422,7 +418,7 @@ class ObjectFactory {
if (chain == null) {
break;
}
- chain = ss.getParentClassLoader(chain);
+ chain = SecuritySupport.getParentClassLoader(chain);
}
// Assert: Current ClassLoader not in chain of
@@ -437,7 +433,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
@@ -533,21 +529,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/xml/serializer/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/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/xml/serializer/ToStream.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java (original)
+++ xalan/java/trunk/src/org/apache/xml/serializer/ToStream.java Thu Dec 29 02:38:30 2011
@@ -108,8 +108,7 @@ abstract public class ToStream extends S
private static final char[] s_systemLineSep;
static {
- SecuritySupport ss = SecuritySupport.getInstance();
- s_systemLineSep = ss.getSystemProperty("line.separator").toCharArray();
+ s_systemLineSep = SecuritySupport.getSystemProperty("line.separator").toCharArray();
}
/**
Modified: xalan/java/trunk/src/org/apache/xml/utils/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/utils/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/utils/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xml/utils/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/xml/utils/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xml/utils/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xml/utils/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/xpath/functions/FuncSystemProperty.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xpath/functions/FuncSystemProperty.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xpath/functions/FuncSystemProperty.java (original)
+++ xalan/java/trunk/src/org/apache/xpath/functions/FuncSystemProperty.java Thu Dec 29 02:38:30 2011
@@ -25,7 +25,6 @@ import java.io.InputStream;
import java.util.Properties;
import org.apache.xpath.XPathContext;
-import org.apache.xpath.objects.XNumber;
import org.apache.xpath.objects.XObject;
import org.apache.xpath.objects.XString;
import org.apache.xpath.res.XPATHErrorResources;
@@ -165,10 +164,8 @@ public class FuncSystemProperty extends
{
try
{
- // Use SecuritySupport class to provide priveleged access to property file
- SecuritySupport ss = SecuritySupport.getInstance();
-
- InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
+ // Use SecuritySupport class to provide privileged access to property file
+ InputStream is = SecuritySupport.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
// get a buffered version
Modified: xalan/java/trunk/src/org/apache/xpath/functions/ObjectFactory.java
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xpath/functions/ObjectFactory.java?rev=1225414&r1=1225413&r2=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xpath/functions/ObjectFactory.java (original)
+++ xalan/java/trunk/src/org/apache/xpath/functions/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/xpath/functions/SecuritySupport.java (from r1225326, xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport12.java)
URL: http://svn.apache.org/viewvc/xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport.java?p2=xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport.java&p1=xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport12.java&r1=1225326&r2=1225414&rev=1225414&view=diff
==============================================================================
--- xalan/java/trunk/src/org/apache/xpath/functions/SecuritySupport12.java (original)
+++ xalan/java/trunk/src/org/apache/xpath/functions/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 () {}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org