Commons Digester
  1. Commons Digester
  2. DIGESTER-38

Digester#parse() throws NullPointerException if unable to instantiate SAX parser

    Details

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

      Operating System: All
      Platform: All

      Description

      This was detected in Digester 1.1.1.
      The method "public XMLReader getReader()" returns null if it cannot instantiate
      a SAX parser. This is fine, but the public "parse" methods all contain
      variations of "getReader().parse(...)". If a SAX parser cannot be instantiated
      (which could happen if an incompatible SAX jar were in the classpath, for
      example), then the parse methods will throw NullPointerException.

      Suggested fixes:
      Either
      1) Change the public getReader() and getParser() methods to throw SAXException,
      instead of returning null, or
      2) Change the implementations of the parse methods to throw SAXException if
      getReader() returns null.

        Activity

        Hide
        Craig McClanahan added a comment -

        Fixed (finally).

        There is now a new getXMLReader() method that throws SAXException if the reader
        cannot be created, and the parse() methods use this instead of getReader().

        Show
        Craig McClanahan added a comment - Fixed (finally). There is now a new getXMLReader() method that throws SAXException if the reader cannot be created, and the parse() methods use this instead of getReader().

          People

          • Assignee:
            Unassigned
            Reporter:
            David H. Martin
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development