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

Usage of ObjectID.fromString in computeMergeChangeLog leads to "java.lang.IllegalArgumentException: Invalid id"

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Component/s: git-plugin
    • Labels:
      None
    • Environment:
      Jenkins ver. 1.480.3, Git Plugin 1.1.29
    • Similar Issues:

      Description

      When configuring a Jenkins job with "merge before build" and setting "Branch to merge to" to develop, the job fails with an "IllegalArgumentException: Invalid id".

      In the class hudson.plugins.git.GitSCM the method computeMergeChangeLog is called with the remote branch name as third paramater (called revFrom in the method declaration). In the method computeMergeChangeLog the following code is executed:

      if (!git.isCommitInRepo(ObjectId.fromString(revFrom)))

      { ... }

      If revFrom is the remote branch name (e.g. "origin/develop"), the fromString method of the JGit class ObjectId throws the IllegalArgumentException because "origin/develop" does not have a length of 40.
      ObjectId.fromString obviously expects a Git commit ID - which has a length of 40 characters - and not the name of a branch ref.

      The bug was introduced with 1.1.27. Installing 1.1.26 fixed the problem.

        Attachments

          Activity

            People

            • Assignee:
              ndeloof Nicolas De Loof
              Reporter:
              user0815 Torsten Beuck
            • Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: