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

P4 Plugin improperly handles filenames with ampersands

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • p4-plugin
    • None
    • Jenkins 1.6.17
      P4 1.2.4
      Workflow 1.8

      A file with an ampersand in its name is causing the P4ChangeParser to fail, since the ampersand is being output to the changelog XML as-is instead of being escaped with

      &
      

      Potentially actuated by all characters which must be escaped in XML. This is in the 'depot' field of a 'file' tag. Crash is here:

      	at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:46)
      

      Here is the exception stack:

      Caused by: org.xml.sax.SAXParseException; systemId: file:[redacted]/builds/286/changelog8.xml; lineNumber: 2133; columnNumber: 133; The entity name must immediately follow the '&' in the entity reference.
      	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLScanner.scanAttributeValue(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanAttribute(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
      	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
      	at javax.xml.parsers.SAXParser.parse(Unknown Source)
      	at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:46)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:546)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1100(WorkflowRun.java:99)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:707)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:120)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:70)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      

          [JENKINS-29017] P4 Plugin improperly handles filenames with ampersands

          Code changed in jenkins
          User: Paul Allen
          Path:
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeParser.java
          src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeSet.java
          http://jenkins-ci.org/commit/p4-plugin/4fc2ad7415d33fd848bd08b846ce56e146b9f662
          Log:
          URL Encode/Decode the depot path for changes.

          Filenames with ampersands was causing Jelly to break when showing the
          change detail.

          JENKINS-29017

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Paul Allen Path: src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeParser.java src/main/java/org/jenkinsci/plugins/p4/changes/P4ChangeSet.java http://jenkins-ci.org/commit/p4-plugin/4fc2ad7415d33fd848bd08b846ce56e146b9f662 Log: URL Encode/Decode the depot path for changes. Filenames with ampersands was causing Jelly to break when showing the change detail. JENKINS-29017

          Paul Allen added a comment -

          Fixed 1.2.5

          Paul Allen added a comment - Fixed 1.2.5

            p4paul Paul Allen
            sumdumgai A C
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: