Community
Participate
Working Groups
Created attachment 166949 [details] Patch to avoid use of a length as an index, plus update to copyright year The zip downloaded by http://sourceforge.net/projects/php-java-bridge/files/Binary%20package/php-java-bridge_6.1.2.1_documentation.zip/download contains a JavaBridge.war which will trigger the StringIndexOutOfBoundsException if you try to import this war, i.e. Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 16 at java.lang.String.charAt(String.java:686) at org.eclipse.jst.j2ee.internal.archive.WebComponentArchiveSaveAdapter.isClassWithoutSource(WebComponentArchiveSaveAdapter.java:94) at org.eclipse.jst.j2ee.internal.archive.J2EEComponentArchiveSaveAdapter.shouldSave(J2EEComponentArchiveSaveAdapter.java:78) at org.eclipse.jst.jee.archive.AbstractArchiveSaveAdapter.save(AbstractArchiveSaveAdapter.java:71) ... 18 more The war contains a "TestInstallation.class" file in the root of the webapp, whose base name is the "magic" 16 characters long (the same length as "WEB-INF/classes/") that invokes the bug, which is also present in WTP 3.1.x. Since the user doesn't have much chance of telling what it is about the war that triggers this symptom, it might be worth fixing in WTP 3.2RC1.
Assigning to Jason - can you review Larry's patch? If it is good, let's get it through PMC approval.
approved
* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such. This exception causes WAR import to fail for this particular WAR. * Is there a work-around? If so, why do you believe the work-around is insufficient? No workaround to make WAR import work with this WAR. * How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added? This has been tested with the UI. Regression testing will be run against the existing JUnits. A new JUnit has not yet been added, Larry, could you do this? * Give a brief technical overview. Who has reviewed this fix? Larry Isaacs created the patch, Chuck Bridgham and Jason Sholl have reviewed it. Jason also tested it. * What is the risk associated with this fix? Minimal risk to WAR import only.
I can give creating a JUnit a shot. I assume this would mean adding an additional test method to the DefectVerificationTests.
For the JUnit, I think you may be able to simply augment one of the existing tests (perhaps WebImportOperationTest or DefectVerificationTests) to import an example WAR with the problem.
good catch. How old is this code? Has this bug existed a long time? I do think should be fixed ... can't imagine a downside ... but this kind of rare-path, non-regression bugs will be the type we'll want to start to think about. remember to mark IP Log for patches ... if appropriate.
code checked into HEAD for 32 RC1
I believe this issue was introduced in WTP 2.0.5 and 3.0. I'm working on a test. It's taking me a little longer because of other distractions and the verification classes aren't happy with a class file in the "webcontent" portion of the war. I'll open a separate bug for the JUnit test once it's ready.
Linking Bug 312129 which contains the JUnit test that verifies the fix.
Verified the problem war file attached to Bug 312129 imports correctly without encountering the StringIndexOutOfBoundsException using WTP I-3.2.0-20100511060448 build.
closing