Commons Digester
  1. Commons Digester
  2. DIGESTER-10

[digester] ParserFeatureSetterFactory uses a wrong method to detect the use of Xerces parser

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: other
      Platform: Other

      Description

      The ParserFeatureSetterFactory relies on the presence of the
      org.apache.xerces.impl.Version class in the classpath to determine that the
      Xerces parser is being used. However it's not always the case and it's possible
      that a different parser is actually being used. In this case the non-standard
      features that are set on the parser factory in the XercesParser class will cause
      an exception to be thrown. The following exception is thrown when using the
      Crimson XML parser with Xercer parser in the classpath:

      org.xml.sax.SAXNotRecognizedException: Feature:
      http://apache.org/xml/features/validation/dynamic
      at org.apache.crimson.parser.XMLReaderImpl.setFeature(XMLReaderImpl.java:219)
      at org.apache.crimson.jaxp.SAXParserImpl.setFeatures(SAXParserImpl.java:150)
      at org.apache.crimson.jaxp.SAXParserImpl.<init>(SAXParserImpl.java:133)
      at
      org.apache.crimson.jaxp.SAXParserFactoryImpl.newSAXParserImpl(SAXParserFactoryImpl.java:113)
      at
      org.apache.crimson.jaxp.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:141)
      at
      org.apache.commons.digester.parser.XercesParser.configureXerces(XercesParser.java:185)
      at
      org.apache.commons.digester.parser.XercesParser.newSAXParser(XercesParser.java:138)
      at
      org.apache.commons.digester.ParserFeatureSetterFactory.newSAXParser(ParserFeatureSetterFactory.java:71)
      at org.apache.commons.digester.Digester.getParser(Digester.java:692)
      at org.apache.commons.digester.Digester.getXMLReader(Digester.java:899)
      at org.apache.commons.digester.Digester.parse(Digester.java:1647)

      This problem can be easily reproduced on JDK 1.4.2, which bundles the Crimson
      parser, by forcing a non-Xerces using the following:

      System.setProperty("javax.xml.parsers.SAXParserFactory",
      "org.apache.crimson.jaxp.SAXParserFactoryImpl");

      The test application must have the Xerces parser in the classpath. This bug is
      present both in versions 1.6 and 1.7.

        Activity

        Peter Severin created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 38894 12342959
        Henri Yandell made changes -
        Project Commons [ 12310458 ] Commons Digester [ 12310471 ]
        Affects Version/s unspecified [ 12311647 ]
        Key COM-2807 DIGESTER-10
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Component/s Digester [ 12311111 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Severin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development