Use SecuritySupport when looking up org.xml.sax.parser system property.
git-svn-id: https://svn.apache.org/repos/asf/xml/commons/trunk@226253 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e37ca1b076
commit
fe0e541d42
@ -1,19 +1,12 @@
|
||||
// SAX parser factory.
|
||||
// http://www.saxproject.org
|
||||
// No warranty; no copyright -- use this as you will.
|
||||
// $Id$
|
||||
//SAX parser factory.
|
||||
//http://www.saxproject.org
|
||||
//No warranty; no copyright -- use this as you will.
|
||||
//$Id$
|
||||
|
||||
package org.xml.sax.helpers;
|
||||
|
||||
import java.lang.ClassNotFoundException;
|
||||
import java.lang.IllegalAccessException;
|
||||
import java.lang.InstantiationException;
|
||||
import java.lang.SecurityException;
|
||||
import java.lang.ClassCastException;
|
||||
|
||||
import org.xml.sax.Parser;
|
||||
|
||||
|
||||
/**
|
||||
* Java-specific class for dynamically loading SAX parsers.
|
||||
*
|
||||
@ -79,18 +72,19 @@ public class ParserFactory {
|
||||
* @see org.xml.sax.Parser
|
||||
*/
|
||||
public static Parser makeParser ()
|
||||
throws ClassNotFoundException,
|
||||
IllegalAccessException,
|
||||
InstantiationException,
|
||||
NullPointerException,
|
||||
ClassCastException
|
||||
throws ClassNotFoundException,
|
||||
IllegalAccessException,
|
||||
InstantiationException,
|
||||
NullPointerException,
|
||||
ClassCastException
|
||||
{
|
||||
String className = System.getProperty("org.xml.sax.parser");
|
||||
if (className == null) {
|
||||
throw new NullPointerException("No value for sax.parser property");
|
||||
} else {
|
||||
return makeParser(className);
|
||||
}
|
||||
SecuritySupport ss = SecuritySupport.getInstance();
|
||||
String className = ss.getSystemProperty("org.xml.sax.parser");
|
||||
if (className == null) {
|
||||
throw new NullPointerException("No value for sax.parser property");
|
||||
} else {
|
||||
return makeParser(className);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -116,13 +110,13 @@ public class ParserFactory {
|
||||
* @see org.xml.sax.Parser
|
||||
*/
|
||||
public static Parser makeParser (String className)
|
||||
throws ClassNotFoundException,
|
||||
IllegalAccessException,
|
||||
InstantiationException,
|
||||
ClassCastException
|
||||
throws ClassNotFoundException,
|
||||
IllegalAccessException,
|
||||
InstantiationException,
|
||||
ClassCastException
|
||||
{
|
||||
return (Parser) NewInstance.newInstance (
|
||||
NewInstance.getClassLoader (), className);
|
||||
return (Parser) NewInstance.newInstance (
|
||||
NewInstance.getClassLoader (), className);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user