Bug 177883 - StringIndexOutOfBoundsException in at org.eclipse.jdt.internal.core.JavaModelManager
Summary: StringIndexOutOfBoundsException in at org.eclipse.jdt.internal.core.JavaModel...
Status: VERIFIED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.4 M2   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-17 04:05 EDT by Nicolás Lichtmaier CLA
Modified: 2007-09-18 04:52 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolás Lichtmaier CLA 2007-03-17 04:05:37 EDT
Build ID: M20070212-1330

I can't compile a project. Their files were created by the Maven 2 plugin. I'm gettin this:

java.lang.StringIndexOutOfBoundsException: String index out of range: 2
at java.lang.String.charAt(String.java:687)
at org.eclipse.jdt.internal.core.JavaModelManager$CompilationParticipants.indexForSourceLevel(JavaModelManager.java:332)
at org.eclipse.jdt.internal.core.JavaModelManager$CompilationParticipants.getCompilationParticipants(JavaModelManager.java:218)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.initializeBuilder(JavaBuilder.java:537)
at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:165)
at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:603)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:167)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:201)
at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:230)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:233)
at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:252)
at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:285)
at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:154)
at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:217)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Comment 1 Frederic Fusier CLA 2007-03-17 11:51:40 EDT
Sounds similar to bug 164707...

Please attach the org.eclipse.jdt.core.prefs of this project (you'll find it
in .settings directory) to confirm this assumption.

Thanks

Comment 2 Frederic Fusier CLA 2007-03-17 11:52:51 EDT
Philippe, sounds clear that we surely need to backport the fix for this bug...
Comment 3 Nicolás Lichtmaier CLA 2007-03-17 13:40:27 EDT
My org.eclipse.jdt.core.prefs file was:

org.eclipse.jdt.core.compiler.codegen.targetPlatform=6
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=6
org.eclipse.jdt.core.compiler.compliance=6

I've removed the project specific compiler settings and now everything works, thanks =).
Comment 4 Nicolás Lichtmaier CLA 2007-03-17 13:51:05 EDT
Uhm, If I correctly read the patch at bug 164707, versionToJdkLevel() will fail to recognize "6.0" as a JDK1_6...

Why not just do:

if(versionID.startsWith("1."))
        versionID = versionID.substring(2);

... and check agains "1", "2", "3"...
Comment 5 Frederic Fusier CLA 2007-08-14 09:32:20 EDT
(In reply to comment #4)
> Uhm, If I correctly read the patch at bug 164707, versionToJdkLevel() will fail
> to recognize "6.0" as a JDK1_6...
> 
> Why not just do:
> 
> if(versionID.startsWith("1."))
>         versionID = versionID.substring(2);
> 
> ... and check agains "1", "2", "3"...
> 
The bug is in Maven as they directly modify the org.eclipse.jdt.core.prefs file instead of using API methods of IJavaProject... As these values are internal, for obvious performance reason, we're *only* expecting them and do not want to accept/verify all possible ones...

Sorry for the late answer but close this bug as WONTFIX
Comment 6 Eric Jodet CLA 2007-09-18 04:42:52 EDT
Use API to modify org.eclipse.jdt.core.prefs file
Verified for 3.4 M2 using build I20070917-0010.