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

hudson.model.Run.getLog throws IndexOutOfBoundsException when called with 0

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core

      I get a stacktrace when configuring a plugin to include no log entries when posting
      job notification:
      java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
      at java.util.LinkedList.entry(LinkedList.java:382)
      at java.util.LinkedList.set(LinkedList.java:345)
      at hudson.model.Run.getLog(Run.java:1963)
      at com.tikal.hudson.plugins.notification.Phase.getLog(Phase.java:141)
      at com.tikal.hudson.plugins.notification.Phase.buildJobState(Phase.java:79)
      at com.tikal.hudson.plugins.notification.Phase.handle(Phase.java:42)
      at com.tikal.hudson.plugins.notification.JobListener.onStarted(JobListener.java:31)
      at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213)
      at hudson.model.Run.execute(Run.java:1747)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:89)
      at hudson.model.Executor.run(Executor.java:240)

          [JENKINS-27441] hudson.model.Run.getLog throws IndexOutOfBoundsException when called with 0

          Daniel Beck added a comment -

          How many log lines did you configure for the endpoint?

          Daniel Beck added a comment - How many log lines did you configure for the endpoint?

          Daniel Beck added a comment -

          OK, seems if you request 0 log lines, and the log only contains a single line, that's first removed and a few lines later set to the truncation message. This fails, as there's no first line.

          Daniel Beck added a comment - OK, seems if you request 0 log lines, and the log only contains a single line, that's first removed and a few lines later set to the truncation message. This fails, as there's no first line.

          Valentin Batz added a comment -

          Yes, i was working on a fix in the meantime, see https://github.com/jenkinsci/jenkins/pull/1591

          Valentin Batz added a comment - Yes, i was working on a fix in the meantime, see https://github.com/jenkinsci/jenkins/pull/1591

          Daniel Beck added a comment -

          If it's just to have a reference issue it's a good idea to self-assign and link to the PR.

          Daniel Beck added a comment - If it's just to have a reference issue it's a good idea to self-assign and link to the PR.

          Valentin Batz added a comment -

          Yes you're right, was not aware of it, sorry for the hassle.

          Valentin Batz added a comment - Yes you're right, was not aware of it, sorry for the hassle.

          Code changed in jenkins
          User: Oleg Nenashev
          Path:
          core/src/main/java/hudson/model/Run.java
          core/src/test/java/hudson/model/RunTest.java
          http://jenkins-ci.org/commit/jenkins/3bb39bbf1c1066570ef8a5a0c265befe6b0aec38
          Log:
          Merge pull request #1591 from vb-linetco/patch-1

          [FIXED JENKINS-27441] avoid IOOBE in getLog when called with 0

          Compare: https://github.com/jenkinsci/jenkins/compare/43188ec7a333...3bb39bbf1c10

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Oleg Nenashev Path: core/src/main/java/hudson/model/Run.java core/src/test/java/hudson/model/RunTest.java http://jenkins-ci.org/commit/jenkins/3bb39bbf1c1066570ef8a5a0c265befe6b0aec38 Log: Merge pull request #1591 from vb-linetco/patch-1 [FIXED JENKINS-27441] avoid IOOBE in getLog when called with 0 Compare: https://github.com/jenkinsci/jenkins/compare/43188ec7a333...3bb39bbf1c10

          Oleg Nenashev added a comment -

          Marked the issue as lts-candidate. The fix should be released in jenkins-1.613

          Oleg Nenashev added a comment - Marked the issue as lts-candidate. The fix should be released in jenkins-1.613

          Antoine Musso added a comment -

          Maybe this fix should be added to the LTS version 1.609.X ?

          Antoine Musso added a comment - Maybe this fix should be added to the LTS version 1.609.X ?

          Daniel Beck added a comment -

          It'll be in 1.609.2, check the labels to this issue

          Daniel Beck added a comment - It'll be in 1.609.2, check the labels to this issue

          Antoine Musso added a comment -

          Excellent! Thanks Daniel for pointing me to the label (very nice).

          Antoine Musso added a comment - Excellent! Thanks Daniel for pointing me to the label (very nice).

            valeni Valentin Batz
            valeni Valentin Batz
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: