Community
Participate
Working Groups
Get the above error sometimes after doing a simple split. Split a list with two elements. element 0 is always available, attempting to access element 1 throws the error. Only seems to happen when you use a number as the index. works if you do it in a loop, see below example. I haven't tried compiling against javac since this is really straight forward code. OF five places in the class where this is being done, it fails in three of them. I have tried split and stringTokenizer and where it fails, it fails for both. String parent=""; String test=""; String dep = "35,==1"; if (!dep.equals("")) {// found a dependency String[] Q = dep.split("\\,"); parent = Q[0]; // always works test = Q[1];// Fails depending on location in class // The code below always works, proving that the split WAS accomplished for (int j = 0; j < Q.length; j++) { if (j == 0) { parent = Q[j]; } if (j == 1) { test = Q[j]; } }
If I paste your code into a main method it works just as expected. So my first guess would be that your program re-assigns dep somewhere down and later-on split produces a 1-element array where Q[1] naturally throws an AIOOBE, i.e., the bug would be in your program not in Eclipse.
Why this would be a JDT bug ? Please provide a complete test case that works with javac and fails with Eclipse.
Closing as INVALID. Provide the data requested in comment 2 to reopen it.
Verified for 3.6M1