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

Bitbucket notify on start failed: String index out of range: -10

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Job setup according to the guideline:

      I always get following error messages, on every job i try to build:

      Bitbucket notify on start failed: String index out of range: -10
      Bitbucket notify on finish failed: String index out of range: -10

      Jenkins version:
      1.644

      Git Plugin:
      2.4.0 + 2.4.1 (tested with both)

        Attachments

          Activity

          Hide
          bnz Erik Woitschig added a comment -

          Please let me know if i can help with further information.

          Show
          bnz Erik Woitschig added a comment - Please let me know if i can help with further information.
          Hide
          flagbit Antonio Mansilla added a comment - - edited

          Hi Erik Woitschig, I'll try to reproduce and fix the problem and let you now whether I need any further information asap.

          Show
          flagbit Antonio Mansilla added a comment - - edited Hi Erik Woitschig , I'll try to reproduce and fix the problem and let you now whether I need any further information asap.
          Hide
          flagbit Antonio Mansilla added a comment -

          Hi Erik Woitschig,

          I've updated my Jenkins instance and plugins to the given version and set up a repository with the same kind of name as yours, but my builds are still successful without any error on the plugin. Can you please provide all posible non sensible information of one of you jobs which is failing?

          Since I'm a bit newby on Java and Jenkins development, maybe somebody can help me in first instance to reproduce or identify the problem.

          Best regards
          Antonio

          Show
          flagbit Antonio Mansilla added a comment - Hi Erik Woitschig , I've updated my Jenkins instance and plugins to the given version and set up a repository with the same kind of name as yours, but my builds are still successful without any error on the plugin. Can you please provide all posible non sensible information of one of you jobs which is failing? Since I'm a bit newby on Java and Jenkins development, maybe somebody can help me in first instance to reproduce or identify the problem. Best regards Antonio
          Hide
          bnz Erik Woitschig added a comment -

          Sure, i try to help where i can:
          Here are more/less the same information from /jenkins/log/all

          Jan 19, 2016 5:31:22 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild Bitbucket notify on start
          Jan 19, 2016 5:31:22 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild Bitbucket notify on start failed: String index out of range: -10
          Jan 19, 2016 5:31:22 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild Bitbucket notify on start succeeded
          Jan 19, 2016 5:31:32 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform Bitbucket notify on finish
          Jan 19, 2016 5:31:32 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform Bitbucket notify on finish failed: String index out of range: -10
          Jan 19, 2016 5:31:32 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform Bitbucket notify on finish succeeded
          

          What / which part creates the error 'String index out of range: -10' ?

          Thank for your fast reply and actions!

          Show
          bnz Erik Woitschig added a comment - Sure, i try to help where i can: Here are more/less the same information from /jenkins/log/all Jan 19, 2016 5:31:22 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild Bitbucket notify on start Jan 19, 2016 5:31:22 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild Bitbucket notify on start failed: String index out of range: -10 Jan 19, 2016 5:31:22 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier prebuild Bitbucket notify on start succeeded Jan 19, 2016 5:31:32 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform Bitbucket notify on finish Jan 19, 2016 5:31:32 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform Bitbucket notify on finish failed: String index out of range: -10 Jan 19, 2016 5:31:32 PM INFO org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier perform Bitbucket notify on finish succeeded What / which part creates the error 'String index out of range: -10' ? Thank for your fast reply and actions!
          Hide
          flagbit Antonio Mansilla added a comment - - edited

          I guess the problem is located on the code that guess the Bitbucket username and repository name from the "Repository URL" field located under the section "Source Code Management".

          Show
          flagbit Antonio Mansilla added a comment - - edited I guess the problem is located on the code that guess the Bitbucket username and repository name from the "Repository URL" field located under the section "Source Code Management".
          Hide
          flagbit Antonio Mansilla added a comment -

          Hi again Erik Woitschig, I doesn't forget your problem and I'm still trying to figure out how to reproduce it. As in your last comment, can you please provide log file but assuring that you execute Jenkins with the debug enabled?

          set MAVEN_OPTS=-Xdebug 
          
          Show
          flagbit Antonio Mansilla added a comment - Hi again Erik Woitschig , I doesn't forget your problem and I'm still trying to figure out how to reproduce it. As in your last comment, can you please provide log file but assuring that you execute Jenkins with the debug enabled? set MAVEN_OPTS=-Xdebug
          Hide
          nbali Balazs Nemeth added a comment - - edited

          I ran into this issue as well - with -12 instead of -10. I tried to fix it on my own, but the logging didn't help much, and didn't bothered to start compiling it myself.

          Please next time don't use logging like this:

          logger.info("Bitbucket notify on start failed: " + e.getMessage());
          

          use this

          logger.log(Level.INFO, "Bitbucket notify on start failed: " + e.getMessage(), e);
          

          instead... that way it would have been way easier to find the issue.

          Show
          nbali Balazs Nemeth added a comment - - edited I ran into this issue as well - with -12 instead of -10. I tried to fix it on my own, but the logging didn't help much, and didn't bothered to start compiling it myself. Please next time don't use logging like this: logger.info( "Bitbucket notify on start failed: " + e.getMessage()); use this logger.log(Level.INFO, "Bitbucket notify on start failed: " + e.getMessage(), e); instead... that way it would have been way easier to find the issue.
          Hide
          flagbit Antonio Mansilla added a comment -

          Hi Balazs Nemeth thank you very much for your advice. I'll try to improve the logging following your indications for the next version of the plugin I've planed to release next week. If you have time I would really appreciate so much if you can spend some of your time to create a pull request with update all uses of the logger with your suggestion, so we can debug easier.

          Show
          flagbit Antonio Mansilla added a comment - Hi Balazs Nemeth thank you very much for your advice. I'll try to improve the logging following your indications for the next version of the plugin I've planed to release next week. If you have time I would really appreciate so much if you can spend some of your time to create a pull request with update all uses of the logger with your suggestion, so we can debug easier.
          Hide
          nbali Balazs Nemeth added a comment -

          https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/pull/3/files

          be advised, I wrote it in the github web editor so without a compiler

          Show
          nbali Balazs Nemeth added a comment - https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin/pull/3/files be advised, I wrote it in the github web editor so without a compiler
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Balázs Németh
          Path:
          src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusNotifier.java
          http://jenkins-ci.org/commit/bitbucket-build-status-notifier-plugin/12c6e53a84763705cdaedf1f4572cdd22bfacacd
          Log:
          JENKINS-32498 logger fix

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Balázs Németh Path: src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusNotifier.java http://jenkins-ci.org/commit/bitbucket-build-status-notifier-plugin/12c6e53a84763705cdaedf1f4572cdd22bfacacd Log: JENKINS-32498 logger fix
          Hide
          flagbit Antonio Mansilla added a comment - - edited

          My apologize for the delay. Last friday was released a new version of the plugin with some improvements in the logging. Now maybe we are capable to identify the problem.

          Erik Woitschig Can you please try to reproduce the error again and paste here the output of the log?

          Show
          flagbit Antonio Mansilla added a comment - - edited My apologize for the delay. Last friday was released a new version of the plugin with some improvements in the logging. Now maybe we are capable to identify the problem. Erik Woitschig Can you please try to reproduce the error again and paste here the output of the log?
          Hide
          bnz Erik Woitschig added a comment - - edited

          Yes, sure - thank you for your actions already.

          Bitbucket notify on start failed: String index out of range: -10
          java.lang.StringIndexOutOfBoundsException: String index out of range: -10
          	at java.lang.String.substring(String.java:1911)
          	at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.createBuildStatusResourceFromBuild(BitbucketBuildStatusNotifier.java:174)
          	at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.prebuild(BitbucketBuildStatusNotifier.java:77)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832)
          	at hudson.model.Build$BuildExecution.doRun(Build.java:144)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
          	at hudson.model.Run.execute(Run.java:1738)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:98)
          	at hudson.model.Executor.run(Executor.java:410)
          
          Bitbucket notify on finish failed: String index out of range: -10
          java.lang.StringIndexOutOfBoundsException: String index out of range: -10
          	at java.lang.String.substring(String.java:1911)
          	at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.createBuildStatusResourceFromBuild(BitbucketBuildStatusNotifier.java:174)
          	at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.perform(BitbucketBuildStatusNotifier.java:101)
          	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
          	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
          	at hudson.model.Build$BuildExecution.cleanUp(Build.java:195)
          	at hudson.model.Run.execute(Run.java:1785)
          	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
          	at hudson.model.ResourceController.execute(ResourceController.java:98)
          	at hudson.model.Executor.run(Executor.java:410)
          

          Please let me know if i can help you further.

          Show
          bnz Erik Woitschig added a comment - - edited Yes, sure - thank you for your actions already. Bitbucket notify on start failed: String index out of range: -10 java.lang.StringIndexOutOfBoundsException: String index out of range: -10 at java.lang. String .substring( String .java:1911) at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.createBuildStatusResourceFromBuild(BitbucketBuildStatusNotifier.java:174) at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.prebuild(BitbucketBuildStatusNotifier.java:77) at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837) at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832) at hudson.model.Build$BuildExecution.doRun(Build.java:144) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Bitbucket notify on finish failed: String index out of range: -10 java.lang.StringIndexOutOfBoundsException: String index out of range: -10 at java.lang. String .substring( String .java:1911) at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.createBuildStatusResourceFromBuild(BitbucketBuildStatusNotifier.java:174) at org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusNotifier.perform(BitbucketBuildStatusNotifier.java:101) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782) at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723) at hudson.model.Build$BuildExecution.cleanUp(Build.java:195) at hudson.model.Run.execute(Run.java:1785) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:98) at hudson.model.Executor.run(Executor.java:410) Please let me know if i can help you further.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Antonio Mansilla
          Path:
          src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusNotifier.java
          http://jenkins-ci.org/commit/bitbucket-build-status-notifier-plugin/6358b8b0f0f1967dcfb0edf52ed67903c7681a80
          Log:
          [Fix JENKINS-32498] Fix problem fetching repo name from URI

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Antonio Mansilla Path: src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusNotifier.java http://jenkins-ci.org/commit/bitbucket-build-status-notifier-plugin/6358b8b0f0f1967dcfb0edf52ed67903c7681a80 Log: [Fix JENKINS-32498] Fix problem fetching repo name from URI
          Hide
          flagbit Antonio Mansilla added a comment -

          Hi Erik Woitschig good news, finally I have found and fixed the problem and will be published on next plugin release.

          Show
          flagbit Antonio Mansilla added a comment - Hi Erik Woitschig good news, finally I have found and fixed the problem and will be published on next plugin release.
          Hide
          bnz Erik Woitschig added a comment -

          Thank you Antonio Mansilla!

          I have tested it, its working! Great!

          Show
          bnz Erik Woitschig added a comment - Thank you Antonio Mansilla ! I have tested it, its working! Great!
          Hide
          bnz Erik Woitschig added a comment -

          Is is my part to close this issue? (newbee )

          Show
          bnz Erik Woitschig added a comment - Is is my part to close this issue? (newbee )
          Hide
          flagbit Antonio Mansilla added a comment -

          I'm newbee as well, so I don't know but I've already marked it as "Resolved" as the bug is fixed and I'd wait to close it until the Bugfix is published on the next version of the plugin. Then you or anyone can close it I think.

          Show
          flagbit Antonio Mansilla added a comment - I'm newbee as well, so I don't know but I've already marked it as "Resolved" as the bug is fixed and I'd wait to close it until the Bugfix is published on the next version of the plugin. Then you or anyone can close it I think.
          Hide
          flagbit Antonio Mansilla added a comment -

          So since the bug was fixed and released in the version 1.0.3, I think the issue can be closed.

          Show
          flagbit Antonio Mansilla added a comment - So since the bug was fixed and released in the version 1.0.3, I think the issue can be closed.

            People

            • Assignee:
              flagbit Antonio Mansilla
              Reporter:
              bnz Erik Woitschig
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: