Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-3769

Parse Fatal Error (SAXParseException) caused by ampersand (&) in TFS changeset comment

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: tfs-plugin
    • Labels:
      None
    • Environment:
      Platform: All, OS: other
    • Similar Issues:

      Description

      When a TFS changeset has an ampersand (&) character in the comment, the TFS
      plugin gets a "Parse Fatal Error" resulting from a SAXParseException. The
      result of this is that no changes are shown for the build in the Hudson UI, even
      though TFS changesets were found.

      Here is an example stacktrace:

      SEVERE: Parse Fatal Error at line 6 column 54: The entity name must immediately
      follow the '&' in the entity reference.
      org.xml.sax.SAXParseException: The entity name must immediately follow the '&'
      in the entity reference.
      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.XMLDocumentFragmentScannerImpl.scanEntityReference(Unknown Source)
      at
      org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.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.commons.digester.Digester.parse(Digester.java:1685)
      at hudson.plugins.tfs.ChangeSetReader.parse(ChangeSetReader.java:54)
      at hudson.plugins.tfs.ChangeSetReader.parse(ChangeSetReader.java:31)
      at hudson.plugins.tfs.ChangeSetReader.parse(ChangeSetReader.java:25)
      at hudson.model.AbstractBuild.calcChangeSet(AbstractBuild.java:429)
      at hudson.model.AbstractBuild.access$500(AbstractBuild.java:78)
      at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:320)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:266)
      at hudson.model.Run.run(Run.java:927)
      at hudson.model.Build.run(Build.java:112)
      at hudson.model.ResourceController.execute(ResourceController.java:93)
      at hudson.model.Executor.run(Executor.java:119)
      org.xml.sax.SAXParseException: The entity name must immediately follow the '&'
      in the entity reference.
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.apache.commons.digester.Digester.parse(Digester.java:1685)
      at hudson.plugins.tfs.ChangeSetReader.parse(ChangeSetReader.java:54)
      at hudson.plugins.tfs.ChangeSetReader.parse(ChangeSetReader.java:31)
      at hudson.plugins.tfs.ChangeSetReader.parse(ChangeSetReader.java:25)
      at hudson.model.AbstractBuild.calcChangeSet(AbstractBuild.java:429)
      at hudson.model.AbstractBuild.access$500(AbstractBuild.java:78)
      at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:320)
      at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:266)
      at hudson.model.Run.run(Run.java:927)
      at hudson.model.Build.run(Build.java:112)
      at hudson.model.ResourceController.execute(ResourceController.java:93)
      at hudson.model.Executor.run(Executor.java:119)

      Here is an example changeset:
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Changeset: 803980
      User: U0026729
      Date: Tuesday, May 26, 2009 3:35:24 PM

      Comment:
      Just testing what happens when I use the & character...Hudson does not seem to
      like it!

      Items:
      add $/Checkpoint/CheckpointWebApp/main/etc/dummy.txt

      Check-in Notes:
      Code Reviewer:
      Performance Reviewer:
      Security Reviewer:
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

      I'm running Hudson 1.307 with TFS plugin 1.4, on a Windows 2003 SP2 server.

        Attachments

          Activity

          Hide
          jeffolson jeffolson added a comment -

          The problem seems to be introduced when the changelog.xml file is written. At
          that point, the data should be XML-escaped. An example of this approach can be
          found in the VSS plugin in the VSSSCM.checkout() method and the escapeForXml()
          method it uses:

          http://fisheye4.atlassian.com/browse/hudson/trunk/hudson/plugins/vss/src/main/java/scm/vss/VSSSCM.java?r=trunk

          Show
          jeffolson jeffolson added a comment - The problem seems to be introduced when the changelog.xml file is written. At that point, the data should be XML-escaped. An example of this approach can be found in the VSS plugin in the VSSSCM.checkout() method and the escapeForXml() method it uses: http://fisheye4.atlassian.com/browse/hudson/trunk/hudson/plugins/vss/src/main/java/scm/vss/VSSSCM.java?r=trunk
          Hide
          redsolo redsolo added a comment -

          Created an attachment (id=718)
          mylyn/context/zip

          Show
          redsolo redsolo added a comment - Created an attachment (id=718) mylyn/context/zip
          Hide
          redsolo redsolo added a comment -

          Mylyn context

          Show
          redsolo redsolo added a comment - Mylyn context
          Hide
          redsolo redsolo added a comment -

          Thanks for digging out what the problem was

          Show
          redsolo redsolo added a comment - Thanks for digging out what the problem was
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : redsolo
          Path:
          trunk/hudson/plugins/tfs/src/main/java/hudson/plugins/tfs/ChangeSetWriter.java
          trunk/hudson/plugins/tfs/src/test/java/hudson/plugins/tfs/ChangeSetReaderTest.java
          trunk/hudson/plugins/tfs/src/test/java/hudson/plugins/tfs/ChangeSetWriterTest.java
          http://fisheye4.cenqua.com/changelog/hudson/?cs=18475
          Log:
          [FIXED JENKINS-3769] - Now it escapes <,>,&,'," chars before writing them to XML file

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : redsolo Path: trunk/hudson/plugins/tfs/src/main/java/hudson/plugins/tfs/ChangeSetWriter.java trunk/hudson/plugins/tfs/src/test/java/hudson/plugins/tfs/ChangeSetReaderTest.java trunk/hudson/plugins/tfs/src/test/java/hudson/plugins/tfs/ChangeSetWriterTest.java http://fisheye4.cenqua.com/changelog/hudson/?cs=18475 Log: [FIXED JENKINS-3769] - Now it escapes <,>,&,'," chars before writing them to XML file

            People

            • Assignee:
              redsolo redsolo
              Reporter:
              jeffolson jeffolson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: