Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: XML-1.0
    • Component/s: XML
    • Labels:
      None
    • Number of attachments :
      0

      Description

      Example below leads to the infinite loop in LineCountParser

      <p></p><pre>i < 3</pre>
      

      which continuously receives SAXParseException :

      org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 16; The markup in the document following the root element must be well-formed.
      	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      	at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
      	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      	at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dispatch(Unknown Source)
      	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      	at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
      	at javax.xml.parsers.SAXParser.parse(SAXParser.java:195)
      	at org.sonar.plugins.xml.parsers.LineCountParser.countLinesOfComment(LineCountParser.java:122)
      

        Activity

        Hide
        Julien HENRY added a comment -

        The infinite loop was caused by the "continue-after-fatal-error" feature of Xerces. I think this feature was enabled in the hope of managing to count comment lines even on malformed XML files. But according to [1] this feature is not safe and can lead to infinite loop, OOM, NPE, ...
        As a result I have disabled it.
        As a result there is no more line count on malformed inputs.

        [1] http://permalink.gmane.org/gmane.text.xml.xerces-j.user/4928

        Show
        Julien HENRY added a comment - The infinite loop was caused by the "continue-after-fatal-error" feature of Xerces. I think this feature was enabled in the hope of managing to count comment lines even on malformed XML files. But according to [1] this feature is not safe and can lead to infinite loop, OOM, NPE, ... As a result I have disabled it. As a result there is no more line count on malformed inputs. [1] http://permalink.gmane.org/gmane.text.xml.xerces-j.user/4928
        Hide
        Freddy Mallet added a comment -

        Manually tested !

        Show
        Freddy Mallet added a comment - Manually tested !

          People

          • Assignee:
            Julien HENRY
            Reporter:
            Evgeny Mandrikov
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: