-
Bug
-
Resolution: Fixed
-
P2
-
javadb_10.0
-
1.4
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2207334 | 7 | Joe Wang | P2 | Closed | Fixed | b112 |
I am referring to javax.xml.stream.XMLInputFactory.newInstance(String factoryId, ClassLoader loader). The javadocs [1] suggest that the first argument is a property name, where as the implementation available in Sun JDK 1.6.0_02 treats it as a property value. Interestingly, the implementation done by BEA and available at [2] differs significantly from that in Sun JDK 1.6.0_02. While [2] uses factoryId as a property name as specified by the javadocs, the latter one uses it as the concrete factory class name. What is the right behavior? If it is interpreted as a concrete class name, then there is indeed no point in having the API in the first place. User can as well do classloader.loadClass(classname).newInstance(), which is exactly what the implementation in JDK does. On the other hand, treating the string as a property name allows caller not to hard code the factory class name and there by allowing some kind of dynamic behavior. A look at [2] reveals that it attempts to read the value of the property as a system property else from jre/lib/jaxp.properties file. It uses the value as the concrete class name. If the property is not defined, then it falls back to a default implementation class name. So, [2] may be correct after all.
[1] http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html#newInstance()
[2] http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2-sources.jar
[1] http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLInputFactory.html#newInstance()
[2] http://download.java.net/maven/1/javax.xml.stream/jars/stax-api-1.0-2-sources.jar
- backported by
-
JDK-2207334 [StAX] XMLInputFactory.newInstance(String factoryId, ...) treats property name as a property value
-
- Closed
-
- relates to
-
JDK-7191547 XMLEventFactory.newFactory(String factoryId, ClassLoader loader) does not work as expected
-
- Closed
-