Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6756677

[StAX] XMLInputFactory.newInstance(String factoryId, ...) treats property name as a property value

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: javadb_10.0
    • Fix Version/s: 1.4.0
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.4
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Backports

        Description

        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

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  joehw Joe Wang
                  Reporter:
                  sanjsaho Sanjeeb Sahoo
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: