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

          Valentin Batz created issue -
          Valentin Batz made changes -
          Description Original: I get a stacktrace when configuring a pluging 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)
          New: 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)

          Daniel Beck added a comment -

          It is not clear what you're doing to get this error. Could you please provide more details?

          https://wiki.jenkins-ci.org/display/JENKINS/How+to+report+an+issue

          Daniel Beck added a comment - It is not clear what you're doing to get this error. Could you please provide more details? https://wiki.jenkins-ci.org/display/JENKINS/How+to+report+an+issue

          Valentin Batz added a comment -

          Steps to reproduce:
          Jenkins 1.604
          notification plugin version 1.9 installed
          Create a new free style job.
          Add a HTTP Notification Endpoint pointing to some request endpoint created on http://requestb.in/
          Set Event to All Events
          Run the job, the exception noted in description will occur instead of a HTTP POST to the created notification Endpoint.

          Valentin Batz added a comment - Steps to reproduce: Jenkins 1.604 notification plugin version 1.9 installed Create a new free style job. Add a HTTP Notification Endpoint pointing to some request endpoint created on http://requestb.in/ Set Event to All Events Run the job, the exception noted in description will occur instead of a HTTP POST to the created notification Endpoint.

          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.
          Daniel Beck made changes -
          Assignee New: Daniel Beck [ danielbeck ]

          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.
          Daniel Beck made changes -
          Assignee Original: Daniel Beck [ danielbeck ] New: Valentin Batz [ valeni ]

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

              Created:
              Updated:
              Resolved: