You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xml-commons-dev@xerces.apache.org by "Michael Glavassevich (JIRA)" <ji...@apache.org> on 2010/12/06 20:07:08 UTC
[jira] Assigned: (XMLCOMMONS-5) NPE in
TransformerFactory.newInstance() when jaxp.properties is present.
[ https://issues.apache.org/jira/browse/XMLCOMMONS-5?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Glavassevich reassigned XMLCOMMONS-5:
---------------------------------------------
Assignee: Michael Glavassevich (was: Commons Developers Mailing List)
> NPE in TransformerFactory.newInstance() when jaxp.properties is present.
> ------------------------------------------------------------------------
>
> Key: XMLCOMMONS-5
> URL: https://issues.apache.org/jira/browse/XMLCOMMONS-5
> Project: XmlCommons
> Issue Type: Bug
> Components: JAXP
> Affects Versions: 1.x
> Environment: Operating System: All
> Platform: PC
> Reporter: Steve
> Assignee: Michael Glavassevich
>
> If jaxp.properties is present in JAVA_HOME/jre/lib and it does not
> contain a javax.xml.transform.TransformerFactory property,
> when issuing TransformerFactory.newInstance, you get the following
> exceptions:
> javax.xml.transform.TransformerFactoryConfigurationError: Provider null could no
> t be instantiated: java.lang.NullPointerException
> at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory
> .java:145)
> at testtrans.main(testtrans.java:13)
> Cause Exception:
> java.lang.NullPointerException
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:279)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
> at javax.xml.transform.FactoryFinder.newInstance(FactoryFinder.java:132)
> at javax.xml.transform.FactoryFinder.find(FactoryFinder.java:188)
> at javax.xml.transform.TransformerFactory.newInstance(TransformerFactory
> .java:139)
> at testtrans.main(testtrans.java:13)
> Test program for above:
> import javax.xml.transform.*;
> // Test program to product null pointer in TransformerFactory.newInstance().
> // JAVA_HOME/jre/lib must contain a jaxp.properties file.
> // The jaxp.properties must not contain a javax.xml.transform.TransformerFactory
> // property. An empty jaxp.properties file will do.
> public class testtrans
> {
> public static void main (String [] args)
> {
> try
> {
> TransformerFactory tFactory = TransformerFactory.newInstance();
> }
> catch (TransformerFactoryConfigurationError e)
> {
> e.printStackTrace();
> Exception ee = e.getException();
> if (ee != null)
> {
> System.out.println("");
> System.out.println("Cause Exception:");
> ee.printStackTrace();
> }
> }
> catch (Throwable t)
> {
> t.printStackTrace();
> }
> }
> }
> javax.xml.transform.FactoryFinder.find() is not checking for a null
> property value. (line 186 in 2.2.D13) and is passing null to
> FactoryFinder.newInstance.
> The find() code does have a catch for Exception, but newInstance() converts
> the null pointer exception to a ConfigurationError which is derived
> from Error not Exception. ConfigurationError is not caught by find() and
> Error is ultimately returned to user.
> Error was discovered when trying to use jaxp.properties to set other
> properties.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: xml-commons-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: xml-commons-dev-help@xerces.apache.org