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

PatternSyntaxException in Windows when updating project files


    • Similar Issues:


      After adding a test project to my repository, I started getting the below error during the build when updating android project files.

      java.util.regex.PatternSyntaxException: Unexpected internal error near index 1
      at java.util.regex.Pattern.error(Unknown Source)
      at java.util.regex.Pattern.compile(Unknown Source)
      at java.util.regex.Pattern.<init>(Unknown Source)
      at java.util.regex.Pattern.compile(Unknown Source)
      at java.lang.String.split(Unknown Source)
      at java.lang.String.split(Unknown Source)
      at hudson.plugins.android_emulator.util.Utils.getRelativePath(Utils.java:616)
      at hudson.plugins.android_emulator.util.Utils.getRelativePathDistance(Utils.java:665)
      at hudson.plugins.android_emulator.builder.UpdateProjectBuilder.perform(UpdateProjectBuilder.java:130)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
      at hudson.model.Build$BuildExecution.build(Build.java:199)
      at hudson.model.Build$BuildExecution.doRun(Build.java:160)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:586)
      at hudson.model.Run.execute(Run.java:1593)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      at hudson.model.ResourceController.execute(ResourceController.java:88)
      at hudson.model.Executor.run(Executor.java:247)

      I tracked down the error which appears to be a misuse of the String.split function in plugins/android_emulator/util/Utils.java:616.

      // Target directory is somewhere above our directory
      String[] fromParts = fromPath.substring(1).split(File.separator);
      final int fromLength = fromParts.length;
      String[] toParts = toPath.substring(1).split(File.separator);
      final int toLength = toParts.length;

      File.separator is a string but String.split is expecting a regex. On windows, File.separator is an invalid regex.



          ryanr23 Ryan Reading created issue -
          aitorthered Aitor Mendaza made changes -
          Field Original Value New Value
          Assignee Christopher Orr [ orrc ] Aitor Mendaza [ aitorthered ]
          aitorthered Aitor Mendaza made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          scm_issue_link SCM/JIRA link daemon made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          orrc Christopher Orr made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 150417 ] JNJira + In-Review [ 206827 ]


            • Assignee:
              aitorthered Aitor Mendaza
              ryanr23 Ryan Reading
            • Votes:
              1 Vote for this issue
              4 Start watching this issue


              • Created: