Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
Windows XP
Description
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.
I have added some code to fix the bug. I have send a pull request to be integrated in the main branch:
https://github.com/jenkinsci/android-emulator-plugin/pull/26