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

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

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None
    • Jenkins ver. 1.480.3, Git Plugin 1.1.29

      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.

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

              Created:
              Updated:
              Resolved: