Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326352 - java.lang.StringIndexOutOfBoundsException: String index out of range: -248337596
Summary: java.lang.StringIndexOutOfBoundsException: String index out of range: -248337596
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Szymon Ptaszkiewicz CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-27 16:40 EDT by funkazzista CLA
Modified: 2014-03-07 08:45 EST (History)
2 users (show)

See Also:


Attachments
Eclipse stacktrace (4.95 KB, text/plain)
2010-09-27 16:41 EDT, funkazzista CLA
no flags Details
Possible patch v.0.1 (763 bytes, patch)
2010-10-01 11:28 EDT, Szymon Ptaszkiewicz CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description funkazzista CLA 2010-09-27 16:40:28 EDT
Build Identifier: 20100617-1415 (Helios Release)

After having created a new project and imported the C sources, Eclipse gives the following error: 
An internal error occurred during: "Refreshing workspace". 
when trying to navigate the source tree.

Reproducible: Always

Steps to Reproduce:
Tried to import some existing C/C++ project with a Makefile (e.g. E-UAE tarball and PUAE sources pulled from GIT).
1. Download http://www.rcdrummond.net/uae/e-uae-0.8.29-WIP4/e-uae-0.8.29-WIP4.tar.bz2
2. Decompress it somewhere and create a new project in Eclipse
3. Right click on project -> Import -> Existing code as Makefile project and select root directory of E-UAE sources
4. Eclipse error: An internal error occurred during: "Refreshing workspace". with stacktrace in the Details section above.
Comment 1 funkazzista CLA 2010-09-27 16:41:56 EDT
Created attachment 179686 [details]
Eclipse stacktrace
Comment 2 Markus Schorn CLA 2010-09-28 02:02:47 EDT
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)
Comment 3 Szymon Ptaszkiewicz CLA 2010-10-01 11:28:15 EDT
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.
Comment 4 Szymon Ptaszkiewicz CLA 2010-10-01 11:49:38 EDT
I made a mistake - there is checkBounds method in Sun/Oracle java implementation but it is not part of API.
Comment 5 Szymon Brandys CLA 2011-03-28 11:02:44 EDT
Moving to 3.8.
Comment 6 Szymon Ptaszkiewicz CLA 2014-03-07 08:45:03 EST
I have never been able to reproduce it. Marking WORKSFORME. Please reopen if you see this again or can provide reproducible steps.