| Summary: | java.lang.StringIndexOutOfBoundsException: String index out of range: -248337596 | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | funkazzista | ||||||
| Component: | Resources | Assignee: | Szymon Ptaszkiewicz <sptaszkiewicz> | ||||||
| Status: | RESOLVED WORKSFORME | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | sptaszkiewicz, Szymon.Brandys | ||||||
| Version: | 3.6 | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | Macintosh | ||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
funkazzista
Created attachment 179686 [details]
Eclipse stacktrace
The exception is raised by the file-system: Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -258403790 at java.lang.String.checkBounds(String.java:368) at java.lang.String.<init>(String.java:457) at org.eclipse.core.internal.filesystem.local.unix.UnixFileNatives.bytesToFileName(UnixFileNatives.java:169) at org.eclipse.core.internal.filesystem.local.unix.UnixFileNatives.fetchFileInfo(UnixFileNatives.java:83) at org.eclipse.core.internal.filesystem.local.LocalFileNativesManager.fetchFileInfo(LocalFileNativesManager.java:31) at org.eclipse.core.internal.filesystem.local.LocalFile.fetchInfo(LocalFile.java:144) Created attachment 180066 [details]
Possible patch v.0.1
Possible solution for the bug.
The exception is thrown from a method that seems to be platform dependent (I can't see such method in Sun/Oracle java.lang.String). For Sun/Oracle implementation of java.lang.String the same exception could be thrown if (length > data.length - start) that means if you try to read more chars than it is available in the array. Tracing back the cause you will see that this could happen if the length returned from readlink(name, target, target.length) is bigger than length of the array target. The readlink method is a native method that wraps equivalent unix method but instead of passing the length of the array to this the method it uses PATH_MAX. This is not good because the value is hardcoded with the value appropriate for the OS where the compiler was run while the size of the array is set as PATH_MAX with the value taken directly from the OS running the code.
I made a mistake - there is checkBounds method in Sun/Oracle java implementation but it is not part of API. Moving to 3.8. I have never been able to reproduce it. Marking WORKSFORME. Please reopen if you see this again or can provide reproducible steps. |