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

StringIndexOutOfBoundsException when indexing SVN repository branches

XMLWordPrintable

      I'm encountering an exception when my Multi-branch pipeline is scanning the Subversion repository causing the exclude regions not to be taken into account.

      Jun 09, 2023 2:00:26 PM SEVERE com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeRegionBranchBuildStrategy isAutomaticBuildUnecpected exception
      java.lang.StringIndexOutOfBoundsException: begin 0, end 40, length 4
      	at java.base/java.lang.String.checkBoundsBeginEnd(String.java:3319)
      	at java.base/java.lang.String.substring(String.java:1874)
      	at com.igalg.jenkins.plugins.multibranch.buildstrategy.BranchBuildStrategyExtension.buildSCMFileSystem(BranchBuildStrategyExtension.java:55)
      	at com.igalg.jenkins.plugins.multibranch.buildstrategy.ExcludeRegionBranchBuildStrategy.isAutomaticBuild(ExcludeRegionBranchBuildStrategy.java:96)
      	at jenkins.branch.BranchBuildStrategy.automaticBuild(BranchBuildStrategy.java:260)
      	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.isAutomaticBuild(MultiBranchProject.java:2251)
      	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.doAutomaticBuilds(MultiBranchProject.java:2202)
      	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observeExisting(MultiBranchProject.java:2028)
      	at jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:1988)
      	at jenkins.scm.impl.subversion.SubversionSCMSource.fetch(SubversionSCMSource.java:453)
      	at jenkins.scm.impl.subversion.SubversionSCMSource.fetch(SubversionSCMSource.java:461)
      	at jenkins.scm.impl.subversion.SubversionSCMSource.fetch(SubversionSCMSource.java:461)
      	at jenkins.scm.impl.subversion.SubversionSCMSource.retrieve(SubversionSCMSource.java:285)
      	at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
      	at jenkins.scm.api.SCMSource.fetch(SCMSource.java:283)
      	at jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:641)
      	at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:278)
      	at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:166)
      	at jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1032)
      	at hudson.model.ResourceController.execute(ResourceController.java:101)
      	at hudson.model.Executor.run(Executor.java:442) 

      Looking at some code snippets I found, it seems that a `substring(0, 40)` call is performed on the revision string. In the SVN repository configured, the revision number is only 4 digits which would explain this exception according to the documentation of the substring method.

      Jenkins version 2.346.2.3
      Plugin version is 1.0.10

            igalg Igal Gluh
            6ar1 Bart
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: