What steps will reproduce the problem? 1. Run the attached Ant build script using "ant -d -f jjdebug.xml" ensuring that the property setting the path to the wicket-1.3.0-rc2.jar file is correct for the test system
What is the expected output? What do you see instead? Should have generated a deps.jar file containing the contents of the wicket JAR. Instead, got a "java.lang.StringIndexOutOfBoundsException: String index out of range: -3" as shown in snippet below.
What version of the product are you using? On what operating system? Testing jarjar1.0-rc6 on a Win2K, SP4 system with JDK 1.6.0_03
Please provide any additional information below.
Got the following exception trace result in which it appears that during visiting a field, PackageRemapper.mapPath() calls String.substring() which throws the exception.
java.lang.StringIndexOutOfBoundsException: String index out of range: -3 at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:115) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.Target.execute(Target.java:357) at org.apache.tools.ant.Target.performTasks(Target.java:385) at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) at org.apache.tools.ant.Project.executeTarget(Project.java:1298) at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java :41) at org.apache.tools.ant.Project.executeTargets(Project.java:1181) at org.apache.tools.ant.Main.runBuild(Main.java:698) at org.apache.tools.ant.Main.startAnt(Main.java:199) at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257) at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104) Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -3 at java.lang.String.substring(String.java:1938) at com.tonicsystems.jarjar.PackageRemapper.mapPath(PackageRemapper.java:84) at com.tonicsystems.jarjar.PackageRemapper.mapValue(PackageRemapper.java:101) at com.tonicsystems.jarjar.asm.commons.RemappingClassAdapter.visitField(Unknown Source)
- jjdebug.xml 834
Comment #1
Posted on Dec 18, 2007 by Swift ElephantJarJar was able to work on many of files from the Wicket JAR but always fails when attempting to use org/apache/wicket/validation/validator/StringValidator.class from the Wicket JAR.
Comment #2
Posted on Jan 28, 2008 by Massive RabbitI've also replicated this with wicket-1.3.0 final, JDK 1.5.0_08-b03, WinXP SP2, jarjar1.0-rc6.
java.lang.StringIndexOutOfBoundsException: String index out of range: -3 at java.lang.String.substring(String.java:1768) at com.tonicsystems.jarjar.PackageRemapper.mapPath(PackageRemapper.java:84) at com.tonicsystems.jarjar.PackageRemapper.mapValue(PackageRemapper.java:101) at com.tonicsystems.jarjar.asm.commons.RemappingClassAdapter.visitField(
Comment #3
Posted on Jan 28, 2008 by Massive RabbitI did a little debugging and found that the Exception is thrown when processing org.apache.wicket.validation.validator.UrlValidator
The Exception happens when visiting the VALID_CHARS field. In UrlValidator the field is defined as
private static final String SPECIAL_CHARS = ";/@&=,.?:+$"; private static final String VALID_CHARS = "[^\s" + SPECIAL_CHARS + "]";
Inside jarjar, the Exception is thrown from PackageRemapper.mapPath(PackageRemapper.java:84). The method is called with a path value of "[^\s;/@&=,.?:+$]". When it gets to line 84 it tries to do this
s = s.substring(0, s.length() - RESOURCE_SUFFIX.length()) + end;
Here s = "[L\s;" and RESOURCE_SUFFIX = "RESOURCE", so the code throws StringIndexOutOfBoundsException.
Comment #4
Posted on Feb 7, 2008 by Massive PandaThis is fixed in SVN.
Status: Fixed
Labels:
Type-Defect
Priority-Medium