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

Invalid characters in changelist triggers SAXParseException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • p4-plugin
    • Jenkins 2.138.1
      P4Plugin 1.9.3

      If a changelist contains a character that is not valid in XML it is written straight to the changelog.xml. When parsed this will cause the following error:

      ...cut...
      com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
      	at javax.xml.parsers.SAXParser.parse(SAXParser.java:328)
      	at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:50)
      Caused: org.xml.sax.SAXException: Could not parse perforce changelog: 
      org.xml.sax.SAXParseException; systemId: file:/var/lib/jenkins/jobs/Pipeline/builds/28/changelog0.xml; lineNumber: 8; columnNumber: 59; An invalid XML character (Unicode: 0x5) was found in the element content of the document
      

      In the above case the character ASCII 5 (ENQ) has been included because it was part of an error message.

        

      Reproduction Steps:

      (1) Create a Jenkinsfile that includes 'checkout'. Mine also includes 'changelog' but that value should default to 'true' if not explicitly set: 

      node{ 
          stage("Repro") {
            checkout changelog: true,
      	 scm: perforce(credential: 'JenkinsMaster',
      	 populate: autoClean(delete: true,
      	 modtime: false,
      	 parallel: 
      		[
      		 enable: false,
      		 minbytes: '1024',
      		 minfiles: '1',
      		 threads: '4'
      		],
      	 pin: '',
      	 quiet: false,
      	 replace: true,
      	 tidy: false),
      	 workspace: manualSpec(charset: 'none',
      	 cleanup: false,
      	 name: 'jenkins-${NODE_NAME}-${JOB_NAME}-${EXECUTOR_NUMBER}',
      	 pinHost: false,
      	 spec: clientSpec(allwrite: false,
      	 backup: false,
      	 changeView: '',
      	 clobber: true,
      	 compress: false,
      	 line: 'LOCAL',
      	 locked: false,
      	 modtime: false,
      	 rmdir: false,
      	 serverID: '',
      	 streamName: '//streams/main',
      	 type: 'WRITABLE',
      	 view: '')))
        }
      }  
      
      
      

      (2) Open '//streams/main/test1.c' for edit.

      (3) Create a changelist with the attached changelist description (bad_description.txt).

      (4) Create a pipeline job (not multibranch) that runs against //streams/main/Jenkinsfile.

      (5) Run the job.

      (6) Full output below:

      tarted by user unknown or anonymous
      Obtained Jenkinsfile from p4-JenkinsMaster-//streams/main
      Running in Durability level: MAX_SURVIVABILITY
      [Pipeline] node
      Running on Jenkins in /var/lib/jenkins/workspace/Pipeline
      [Pipeline] {
      [Pipeline] stage
      [Pipeline] { (Repro)
      [Pipeline] echo
      null
      [Pipeline] checkout
      (p4):cmd:... p4 client -o jenkins-master-Pipeline-0
      p4 client -o jenkins-master-Pipeline-0(p4):stop:4
      (p4):cmd:... p4 info
      p4 info(p4):stop:5
      (p4):cmd:... p4 info
      p4 info(p4):stop:6
      (p4):cmd:... p4 client -i
      p4 client -iClient jenkins-master-Pipeline-0 saved.(p4):stop:7
      (p4):cmd:... p4 counter change
      p4 counter change(p4):stop:8
      (p4):cmd:... p4 changes -m1 -ssubmitted //jenkins-master-Pipeline-0/...
      p4 changes -m1 -ssubmitted //jenkins-master-Pipeline-0/...Change 60 on 2018/11/23 by super@ws_stream '   My description...
         desc.tx'
      (p4):stop:9
      (p4):cmd:... p4 repos -C
      p4 repos -C(p4):stop:10
      Building on Node: master
      (p4):cmd:... p4 client -o jenkins-master-Pipeline-0
      p4 client -o jenkins-master-Pipeline-0(p4):stop:4
      (p4):cmd:... p4 info
      p4 info(p4):stop:5
      (p4):cmd:... p4 info
      p4 info(p4):stop:6
      (p4):cmd:... p4 client -i
      p4 client -iClient jenkins-master-Pipeline-0 not changed.(p4):stop:7P4 Task: establishing connection.
      ... server: vm-kwirth-swarm182-xenial:1666
      ... node: vm-kwirth-swarm182-xenialP4 Task: reverting all pending and shelved revisions.
      (p4):cmd:... p4 revert /var/lib/jenkins/workspace/Pipeline/...
      p4 revert /var/lib/jenkins/workspace/Pipeline/.../var/lib/jenkins/workspace/Pipeline/... - file(s) not opened on this client.(p4):stop:8
      ... rm [abandoned files]
      duration: (2ms)P4 Task: cleaning workspace to match have list.
      (p4):cmd:... p4 reconcile -w -f /var/lib/jenkins/workspace/Pipeline/...
      p4 reconcile -w -f /var/lib/jenkins/workspace/Pipeline/.../var/lib/jenkins/workspace/Pipeline/... - no file(s) to reconcile.(p4):stop:9
      duration: (24ms)P4 Task: syncing files at change: 60
      (p4):cmd:... p4 sync /var/lib/jenkins/workspace/Pipeline/...@60
      p4 sync /var/lib/jenkins/workspace/Pipeline/...@60... totalFileSize 1492
      ... totalFileCount 2
      //streams/main/Jenkinsfile#16 - updated as /var/lib/jenkins/workspace/Pipeline/Jenkinsfile
      //streams/main/test1.c#3 - updated as /var/lib/jenkins/workspace/Pipeline/test1.c
      (p4):stop:10
      duration: (4ms)P4 Task: saving built changes.
      Found last change 50 on syncID jenkins-NODE_NAME-Pipeline-EXECUTOR_NUMBER
      (p4):cmd:... p4 client -o jenkins-master-Pipeline-0
      p4 client -o jenkins-master-Pipeline-0(p4):stop:4
      (p4):cmd:... p4 info
      p4 info(p4):stop:5
      (p4):cmd:... p4 info
      p4 info(p4):stop:6
      (p4):cmd:... p4 client -i
      p4 client -iClient jenkins-master-Pipeline-0 not changed.(p4):stop:7
      (p4):cmd:... p4 changes -m20 //jenkins-master-Pipeline-0/...@50,60
      p4 changes -m20 //jenkins-master-Pipeline-0/...@50,60Change 60 on 2018/11/23 by super@ws_stream '   My description...
         desc.tx'
      Change 59 on 2018/11/23 by super@ws_stream 'New Jenkinsfile using checkout'
      Change 58 on 2018/11/23 by super@ws_stream 'P4:Edit test1.c
      '
      Change 50 on 2018/11/06 by super@ws_stream 'Edited'
      (p4):stop:8
      (p4):cmd:... p4 changes -l -m1 @60
      p4 changes -l -m1 @60Change 60 on 2018/11/23 by super@ws_stream '   My description...
         desc.txt
         #JIRA: CAS-85838: [ASSERT] Count propery for entity(0?@) doesn't set-getRandomInt-Engine\Entity\MiscEntities.cpp (473)
      '
      (p4):stop:9
      (p4):cmd:... p4 user -o super
      p4 user -o super(p4):stop:10
      (p4):cmd:... p4 describe -s -m51 60
      p4 describe -s -m51 60(p4):stop:11
      (p4):cmd:... p4 fixes -c60
      p4 fixes -c60(p4):stop:12
      (p4):cmd:... p4 changes -l -m1 @59
      p4 changes -l -m1 @59Change 59 on 2018/11/23 by super@ws_stream 'New Jenkinsfile using checkout'
      (p4):stop:13
      (p4):cmd:... p4 user -o super
      p4 user -o super(p4):stop:14
      (p4):cmd:... p4 describe -s -m51 59
      p4 describe -s -m51 59(p4):stop:15
      (p4):cmd:... p4 fixes -c59
      p4 fixes -c59(p4):stop:16
      (p4):cmd:... p4 changes -l -m1 @58
      p4 changes -l -m1 @58Change 58 on 2018/11/23 by super@ws_stream 'P4:Edit test1.c
      '
      (p4):stop:17
      (p4):cmd:... p4 user -o super
      p4 user -o super(p4):stop:18
      (p4):cmd:... p4 describe -s -m51 58
      p4 describe -s -m51 58(p4):stop:19
      (p4):cmd:... p4 fixes -c58
      p4 fixes -c58(p4):stop:20
      ... done[Pipeline] }
      [Pipeline] // stage
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      org.xml.sax.SAXParseException; systemId: file:/var/lib/jenkins/jobs/Pipeline/builds/28/changelog0.xml; lineNumber: 8; columnNumber: 59; An invalid XML character (Unicode: 0x5) was found in the element content of the document.
      	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
      	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
      	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
      	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
      	at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2923)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
      	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
      	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
      	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
      	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
      	at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:327)
      	at javax.xml.parsers.SAXParser.parse(SAXParser.java:328)
      	at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:50)
      Caused: org.xml.sax.SAXException: Could not parse perforce changelog: 
      org.xml.sax.SAXParseException; systemId: file:/var/lib/jenkins/jobs/Pipeline/builds/28/changelog0.xml; lineNumber: 8; columnNumber: 59; An invalid XML character (Unicode: 0x5) was found in the element content of the document.
      	at org.jenkinsci.plugins.p4.changes.P4ChangeParser.parse(P4ChangeParser.java:54)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.onCheckout(WorkflowRun.java:1045)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$1400(WorkflowRun.java:143)
      	at org.jenkinsci.plugins.workflow.job.WorkflowRun$SCMListenerImpl.onCheckout(WorkflowRun.java:1253)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:90)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:77)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1$1.call(SynchronousNonBlockingStepExecution.java:50)
      	at hudson.security.ACL.impersonate(ACL.java:290)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution$1.run(SynchronousNonBlockingStepExecution.java:47)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at java.lang.Thread.run(Thread.java:748)
      Finished: FAILURE
      

       

       

       

       

       

       

       

            p4paul Paul Allen
            p4karl Karl Wirth
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: