View | Details | Raw Unified | Return to bug 164707 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/builder/BasicBuildTests.java (+15 lines)
Lines 19-24 Link Here
19
import org.eclipse.core.resources.IMarker;
19
import org.eclipse.core.resources.IMarker;
20
import org.eclipse.core.runtime.CoreException;
20
import org.eclipse.core.runtime.CoreException;
21
import org.eclipse.core.runtime.IPath;
21
import org.eclipse.core.runtime.IPath;
22
import org.eclipse.jdt.core.IJavaProject;
22
import org.eclipse.jdt.core.JavaCore;
23
import org.eclipse.jdt.core.JavaCore;
23
import org.eclipse.jdt.core.JavaModelException;
24
import org.eclipse.jdt.core.JavaModelException;
24
import org.eclipse.jdt.core.tests.util.Util;
25
import org.eclipse.jdt.core.tests.util.Util;
Lines 402-405 Link Here
402
		fullBuild(projectPath);
403
		fullBuild(projectPath);
403
		expectingNoProblems();
404
		expectingNoProblems();
404
	}
405
	}
406
407
	/**
408
	 * @bug 164707: ArrayIndexOutOfBoundsException in JavaModelManager if source level == 6.0
409
	 * @test Ensure that AIIOB does not longer happen with invalid source level string
410
	 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=164707"
411
	 */
412
	public void testBug164707() throws JavaModelException {
413
		IPath projectPath = env.addProject("Project"); //$NON-NLS-1$
414
		IJavaProject javaProject = env.getJavaProject(projectPath); 
415
		javaProject.setOption(JavaCore.COMPILER_SOURCE, "invalid");
416
		env.addExternalJars(projectPath, Util.getJavaClassLibs());
417
		fullBuild(projectPath);
418
		expectingNoProblems();
419
	}
405
}
420
}
(-)model/org/eclipse/jdt/internal/core/JavaModelManager.java (-1 / +9 lines)
Lines 329-335 Link Here
329
		 */
329
		 */
330
		private int indexForSourceLevel(String sourceLevel) {
330
		private int indexForSourceLevel(String sourceLevel) {
331
			if (sourceLevel == null) return 0;
331
			if (sourceLevel == null) return 0;
332
			return sourceLevel.charAt(2) - 49;
332
			int index = sourceLevel.charAt(2) - 49;
333
			if (index < 0 || index > 5) {
334
				// avoid AIIOB when source level is malformed (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=164707)
335
				if (VERBOSE) {
336
					System.out.println(sourceLevel+" is not a valid compiler source level (1.1 -> 1.6 expected)"); //$NON-NLS-1$
337
				}
338
				return 0;
339
			}
340
			return index;
333
		}
341
		}
334
		
342
		
335
		private int sortParticipants(ArrayList group, IConfigurationElement[] configElements, int index) {
343
		private int sortParticipants(ArrayList group, IConfigurationElement[] configElements, int index) {

Return to bug 164707