java.lang.ArrayIndexOutOfBoundsException: 1

Jenkins JIRA | jlongman | 2 years ago
  1. 0

    When the {{changelog.xml}} is missing entries, specifically {{parent}} a giant stacktrace appears in the build page. This also breaks wallboards which call {{fetchJobViews}}. To test, take a changelog and delete the parent SHA1 id, ensure a trailing space is left after {{parent}}, so "parent " as opposed to "parent 8d79986e611a81aa3ace7036b8b52351541604d6". I still don't know why the headers were missing, any information about where the {{changelog.xml}} is generated would be helpful, since a {{git log --pretty=raw $SHA1}} shows the {{parent}} correctly. (I should note that the master is an older git because maintenance is downtime and the slaves are all ansible'ized and up to date.) Created [JENKINS-28291] to track. I should note that this is *NOT* caused by the lack of the Mail plugin being properly configured - [JENKINS-19045] - it is present, enabled and configured: it works fine. {noformat} javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/usr/home/hudson/hudson/war/WEB-INF/lib/jenkins-core-1.608.jar!/hudson/model/AbstractBuild/index.jelly:67:61: <st:include> No page found 'digest.jelly' for class hudson.matrix.MatrixBuild at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:117) at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:127) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:735) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) [...] Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/usr/home/hudson/hudson/war/WEB-INF/lib/jenkins-core-1.608.jar!/hudson/model/AbstractBuild/index.jelly:67:61: <st:include> No page found 'digest.jelly' for class hudson.matrix.MatrixBuild at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:124) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) [...] {noformat} In the jenkins http://jenkins/log/all what appears is: {noformat} Caught exception evaluating: it.changeSet in /job/4.9.1/2/TARGET_ARCH=amd64,label=xipos9/. Reason: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor357.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) [...] at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.ArrayIndexOutOfBoundsException {noformat} Separately, the {{JiraIssueIndexer}} failed with this stacktrace {noformat} SEVERE: Timer task hudson.plugins.jiraapi.IssueIndexerThread@8e3484d failed java.lang.ArrayIndexOutOfBoundsException: 1 at hudson.plugins.git.GitChangeSet.parseCommit(GitChangeSet.java:104) at hudson.plugins.git.GitChangeSet.<init>(GitChangeSet.java:89) at hudson.plugins.git.GitChangeLogParser.parseCommit(GitChangeLogParser.java:73) at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:57) at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:44) at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:25) at hudson.scm.ChangeLogParser.parse(ChangeLogParser.java:57) at hudson.model.AbstractBuild.calcChangeSet(AbstractBuild.java:906) at hudson.model.AbstractBuild.getChangeSet(AbstractBuild.java:874) at hudson.plugins.jiraapi.index.IssueIndexer.findBuildRelatedIssues(IssueIndexer.java:209) at hudson.plugins.jiraapi.index.IssueIndexer.fullIndex(IssueIndexer.java:171) at hudson.plugins.jiraapi.IssueIndexerThread.doRun(IssueIndexerThread.java:68) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:51) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [...] at java.lang.Thread.run(Thread.java:724) {noformat} Inspecting these lines: {code:java|title=GitChangeSet.java} if (line.startsWith("commit ")) { this.id = line.split(" ")[1]; } else if (line.startsWith("tree ")) { } else if (line.startsWith("parent ")) { this.parentCommit = line.split(" ")[1]; } else if (line.startsWith(PREFIX_COMMITTER)) { {code} makes it pretty obvious the code is going to fail in these conditions. (Line 104 is actually the line after the "parent " test.) This was verified in a debugger which led to the files being obviously incorrect. Hand editing these {{changelog.xml}} files and adding any value corrects the issue - the {{parent}} attribute is used for {{gitweb}} and not elsewhere from what I can see, so was sufficient to test the theory even if it is not the correct SHA1 and breaks web links. This code lacks [robustness|http://en.wikipedia.org/wiki/Robustness_principle] by assuming the input is correct. A simple patch would test the array length and report an error, I can do it it's more understanding the correct erroring (or ignoring and logging) methods, advice appreciated. An example changelog.xml {noformat:title=changelog.xml} commit 452eada08db501e04f3de9441065bb72728dbc9b tree 9b346ed5ba67deaec8f8c608fe03530afa900334 parent author J. Longman <longman@foo.com> 2015-05-05 14:40:55 -0400 committer J. Longman <longman@foo.com> 2015-05-05 14:57:20 -0400 CORE-6830 another empty commit - will rewrite branch :000000 100644 0000000000000000000000000000000000000000 5a6b53c58b4df185b955f46b7ffdfb26671242a5 A .gitignore :000000 100644 0000000000000000000000000000000000000000 49d479c60ef90e82eae181f33c6f12ade0a6687d A .gitmodules [...etc] {noformat}

    Jenkins JIRA | 2 years ago | jlongman
    java.lang.ArrayIndexOutOfBoundsException: 1
  2. 0

    When the {{changelog.xml}} is missing entries, specifically {{parent}} a giant stacktrace appears in the build page. This also breaks wallboards which call {{fetchJobViews}}. To test, take a changelog and delete the parent SHA1 id, ensure a trailing space is left after {{parent}}, so "parent " as opposed to "parent 8d79986e611a81aa3ace7036b8b52351541604d6". I still don't know why the headers were missing, any information about where the {{changelog.xml}} is generated would be helpful, since a {{git log --pretty=raw $SHA1}} shows the {{parent}} correctly. (I should note that the master is an older git because maintenance is downtime and the slaves are all ansible'ized and up to date.) Created [JENKINS-28291] to track. I should note that this is *NOT* caused by the lack of the Mail plugin being properly configured - [JENKINS-19045] - it is present, enabled and configured: it works fine. {noformat} javax.servlet.ServletException: org.apache.commons.jelly.JellyTagException: jar:file:/usr/home/hudson/hudson/war/WEB-INF/lib/jenkins-core-1.608.jar!/hudson/model/AbstractBuild/index.jelly:67:61: <st:include> No page found 'digest.jelly' for class hudson.matrix.MatrixBuild at org.kohsuke.stapler.jelly.JellyClassTearOff.serveIndexJelly(JellyClassTearOff.java:117) at org.kohsuke.stapler.jelly.JellyFacet.handleIndexRequest(JellyFacet.java:127) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:735) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876) [...] Caused by: org.apache.commons.jelly.JellyTagException: jar:file:/usr/home/hudson/hudson/war/WEB-INF/lib/jenkins-core-1.608.jar!/hudson/model/AbstractBuild/index.jelly:67:61: <st:include> No page found 'digest.jelly' for class hudson.matrix.MatrixBuild at org.kohsuke.stapler.jelly.IncludeTag.doTag(IncludeTag.java:124) at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:269) at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95) [...] {noformat} In the jenkins http://jenkins/log/all what appears is: {noformat} Caught exception evaluating: it.changeSet in /job/4.9.1/2/TARGET_ARCH=amd64,label=xipos9/. Reason: java.lang.reflect.InvocationTargetException java.lang.reflect.InvocationTargetException at sun.reflect.GeneratedMethodAccessor357.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) [...] at java.lang.Thread.run(Thread.java:724) Caused by: java.lang.ArrayIndexOutOfBoundsException {noformat} Separately, the {{JiraIssueIndexer}} failed with this stacktrace {noformat} SEVERE: Timer task hudson.plugins.jiraapi.IssueIndexerThread@8e3484d failed java.lang.ArrayIndexOutOfBoundsException: 1 at hudson.plugins.git.GitChangeSet.parseCommit(GitChangeSet.java:104) at hudson.plugins.git.GitChangeSet.<init>(GitChangeSet.java:89) at hudson.plugins.git.GitChangeLogParser.parseCommit(GitChangeLogParser.java:73) at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:57) at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:44) at hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:25) at hudson.scm.ChangeLogParser.parse(ChangeLogParser.java:57) at hudson.model.AbstractBuild.calcChangeSet(AbstractBuild.java:906) at hudson.model.AbstractBuild.getChangeSet(AbstractBuild.java:874) at hudson.plugins.jiraapi.index.IssueIndexer.findBuildRelatedIssues(IssueIndexer.java:209) at hudson.plugins.jiraapi.index.IssueIndexer.fullIndex(IssueIndexer.java:171) at hudson.plugins.jiraapi.IssueIndexerThread.doRun(IssueIndexerThread.java:68) at hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:51) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [...] at java.lang.Thread.run(Thread.java:724) {noformat} Inspecting these lines: {code:java|title=GitChangeSet.java} if (line.startsWith("commit ")) { this.id = line.split(" ")[1]; } else if (line.startsWith("tree ")) { } else if (line.startsWith("parent ")) { this.parentCommit = line.split(" ")[1]; } else if (line.startsWith(PREFIX_COMMITTER)) { {code} makes it pretty obvious the code is going to fail in these conditions. (Line 104 is actually the line after the "parent " test.) This was verified in a debugger which led to the files being obviously incorrect. Hand editing these {{changelog.xml}} files and adding any value corrects the issue - the {{parent}} attribute is used for {{gitweb}} and not elsewhere from what I can see, so was sufficient to test the theory even if it is not the correct SHA1 and breaks web links. This code lacks [robustness|http://en.wikipedia.org/wiki/Robustness_principle] by assuming the input is correct. A simple patch would test the array length and report an error, I can do it it's more understanding the correct erroring (or ignoring and logging) methods, advice appreciated. An example changelog.xml {noformat:title=changelog.xml} commit 452eada08db501e04f3de9441065bb72728dbc9b tree 9b346ed5ba67deaec8f8c608fe03530afa900334 parent author J. Longman <longman@foo.com> 2015-05-05 14:40:55 -0400 committer J. Longman <longman@foo.com> 2015-05-05 14:57:20 -0400 CORE-6830 another empty commit - will rewrite branch :000000 100644 0000000000000000000000000000000000000000 5a6b53c58b4df185b955f46b7ffdfb26671242a5 A .gitignore :000000 100644 0000000000000000000000000000000000000000 49d479c60ef90e82eae181f33c6f12ade0a6687d A .gitmodules [...etc] {noformat}

    Jenkins JIRA | 2 years ago | jlongman
    java.lang.ArrayIndexOutOfBoundsException: 1
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    ArrayIndexOutOfBounds When Splitting String

    Stack Overflow | 4 years ago | n0shadow
    java.lang.ArrayIndexOutOfBoundsException: 1
  5. 0

    ArrayIndexOutOfBoundsException occurring when program running

    Stack Overflow | 4 years ago | dharma
    java.lang.ArrayIndexOutOfBoundsException: 1

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ArrayIndexOutOfBoundsException

      1

      at hudson.plugins.git.GitChangeSet.parseCommit()
    2. Hudson GIT plugin
      GitChangeLogParser.parse
      1. hudson.plugins.git.GitChangeSet.parseCommit(GitChangeSet.java:104)
      2. hudson.plugins.git.GitChangeSet.<init>(GitChangeSet.java:89)
      3. hudson.plugins.git.GitChangeLogParser.parseCommit(GitChangeLogParser.java:73)
      4. hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:57)
      5. hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:44)
      6. hudson.plugins.git.GitChangeLogParser.parse(GitChangeLogParser.java:25)
      6 frames
    3. Hudson
      AbstractBuild.getChangeSet
      1. hudson.scm.ChangeLogParser.parse(ChangeLogParser.java:57)
      2. hudson.model.AbstractBuild.calcChangeSet(AbstractBuild.java:906)
      3. hudson.model.AbstractBuild.getChangeSet(AbstractBuild.java:874)
      3 frames
    4. hudson.plugins.jiraapi
      IssueIndexerThread.doRun
      1. hudson.plugins.jiraapi.index.IssueIndexer.findBuildRelatedIssues(IssueIndexer.java:209)
      2. hudson.plugins.jiraapi.index.IssueIndexer.fullIndex(IssueIndexer.java:171)
      3. hudson.plugins.jiraapi.IssueIndexerThread.doRun(IssueIndexerThread.java:68)
      3 frames
    5. Hudson
      SafeTimerTask.run
      1. hudson.triggers.SafeTimerTask.run(SafeTimerTask.java:51)
      1 frame
    6. Java RT
      Thread.run
      1. java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)[...]
      2. java.lang.Thread.run(Thread.java:724)
      2 frames