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

Changelist parsing fails when description contains reserved words

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: perforce-plugin
    • Labels:
      None
    • Environment:
      Perforce 2007.2
    • Similar Issues:

      Description

      The Hudson perforce plug-in is currently throwing exceptions for any changelists which contain "reserved" text in the changelist description. This appears to be introduced by the p4v client when creating changelist descriptions. Here is an example of a changelist which contains the problem (i.e. containing "Jobs fixed ..." in the changelist description):

      ===== begin output of "p4 describe -s 470718 =====
      Change 470718 by someuser@someclient on 2010/10/01 15:32:59

      Additional logic for org assoc validations at doc import time.

      Jobs fixed ...

      Jobs fixed ...

      SDRLS98139 on 2010/10/01 by pdbugs closed
      Affected files ...

      ... //depotxyz/fileabc#6 edit
      ====== end output of "p4 describe -s 470718 ======

      In this case, the Hudson perforce plug-in fails and throws an exception:

      18:16:46 [5.5_Continuous_Build] $ /usr/local/bin/p4 describe -s 470718
      18:16:46 Caught exception communicating with perforce. Failed to retrieve changelist.com.tek42.perforce.PerforceException: Failed to retrieve changelist.
      18:16:46 at com.tek42.perforce.parse.ChangelistBuilder.build(ChangelistBuilder.java:185)
      18:16:46 at com.tek42.perforce.parse.Changes.getChangelist(Changes.java:63)
      18:16:46 at com.tek42.perforce.parse.Changes.getChangelistsFromNumbers(Changes.java:381)
      18:16:46 at hudson.plugins.perforce.PerforceSCM.checkout(PerforceSCM.java:552)
      18:16:46 at hudson.model.AbstractProject.checkout(AbstractProject.java:1082)
      18:16:46 at hudson.model.AbstractBuild$AbstractRunner.checkout(AbstractBuild.java:479)
      18:16:46 at hudson.model.AbstractBuild$AbstractRunner.run(AbstractBuild.java:411)
      18:16:46 at hudson.model.Run.run(Run.java:1273)
      18:16:46 at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      18:16:46 at hudson.model.ResourceController.execute(ResourceController.java:88)
      18:16:46 at hudson.model.Executor.run(Executor.java:137)
      18:16:46 Caused by: java.util.NoSuchElementException
      18:16:46 at java.util.StringTokenizer.nextToken(StringTokenizer.java:332)
      18:16:46 at com.tek42.perforce.parse.ChangelistBuilder.build(ChangelistBuilder.java:120)
      18:16:46 ... 10 more

      The problem exists because the StringTokenizer used inside the ChangelistBuilder class also considers tabs as a delimiter when parsing the output of the "p4 describe" command. This means that the parser is incapable of using the indenting provided by the "p4 describe" output to distinguish between keywords generated by the Perforce server and keyword text that is part of the changelist description.

      Steps to reproduce:
      1) Create a changelist which contains "Jobs fixed ..." within the changelist description
      2) Create a Hudson job which syncs from Perforce (i.e. Poll SCM)

      When the job attempts to obtain changelist information for the changelist which contains "Jobs fixed ..." in the changelist description, it will throw an exception and will fail to advance to the next changelist. This effectively causes the job to continually fail at the same point, unable to obtain information about subsequent changelists.

        Attachments

          Activity

          Hide
          rpetti Rob Petti added a comment -

          Please provide your perforce plugin version and hudson version.

          Show
          rpetti Rob Petti added a comment - Please provide your perforce plugin version and hudson version.
          Hide
          sstafford sstafford added a comment -

          I'm using the latest versions of Hudson and the Perforce plug-in.

          Hudson: 1.377
          Perforce Plug-in: 1.1.9

          I've also built the Perforce plugin from the latest source in case you want me to make local changes for testing.

          Show
          sstafford sstafford added a comment - I'm using the latest versions of Hudson and the Perforce plug-in. Hudson: 1.377 Perforce Plug-in: 1.1.9 I've also built the Perforce plugin from the latest source in case you want me to make local changes for testing.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in hudson
          User: : rpetti
          Path:
          trunk/hudson/plugins/perforce/src/main/java/com/tek42/perforce/parse/ChangelistBuilder.java
          http://jenkins-ci.org/commit/35548
          Log:
          [FIXED JENKINS-7679] remove tab as a deliminator when parsing changesets.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in hudson User: : rpetti Path: trunk/hudson/plugins/perforce/src/main/java/com/tek42/perforce/parse/ChangelistBuilder.java http://jenkins-ci.org/commit/35548 Log: [FIXED JENKINS-7679] remove tab as a deliminator when parsing changesets.

            People

            • Assignee:
              rpetti Rob Petti
              Reporter:
              sstafford sstafford
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: