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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java (+49 lines)
Lines 17-22 Link Here
17
17
18
import junit.framework.Test;
18
import junit.framework.Test;
19
19
20
import org.eclipse.core.resources.IFile;
21
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.resources.IncrementalProjectBuilder;
22
import org.eclipse.core.resources.IncrementalProjectBuilder;
21
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.CoreException;
22
import org.eclipse.core.runtime.IPath;
24
import org.eclipse.core.runtime.IPath;
Lines 10003-10008 Link Here
10003
}
10005
}
10004
10006
10005
/**
10007
/**
10008
 * @bug 222284: [search] ZipException while searching if linked jar doesn't exist any longer
10009
 * @test Ensure that no exception is raised while searching for a type of the missing jar file
10010
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=222284"
10011
 */
10012
public void testBug222284() throws Exception {
10013
	String jarName = "lib222284.jar";
10014
	String jarPath = getExternalPath()+jarName;
10015
	IFile jarFile = JAVA_PROJECT.getProject().getFile(jarName);
10016
	try {
10017
		// Create jar and add it to JavaSearchBugs project build path
10018
		String[] pathsAndContents = new String[] {
10019
			"pack/Ref.java",
10020
			"package pack;\n" +
10021
			"public class Ref {\n" +
10022
			"}",
10023
			};
10024
		createJar(pathsAndContents, jarPath);
10025
		jarFile.createLink(new Path(jarPath), IResource.NONE, null);
10026
		addLibraryEntry(JAVA_PROJECT, "/JavaSearchBugs/lib222284.jar", null);
10027
10028
		// Create file and wait for indexes
10029
		createFile("/JavaSearchBugs/src/Test.java",
10030
			"import pack.Ref;" +
10031
			"public class Test {\n" +
10032
			"	Ref ref;" + 
10033
			"}\n"
10034
		);
10035
		waitUntilIndexesReady();
10036
10037
		// Exit, delete jar and restart
10038
		simulateExit();
10039
		deleteExternalResource(jarName);
10040
		simulateRestart();
10041
10042
		// Search for references to a class of deleted jar file, expect no result
10043
		search("pack.Ref", TYPE, REFERENCES);
10044
		assertSearchResults(
10045
			"src/Test.java [Ref] POTENTIAL_MATCH\n" + 
10046
			"src/Test.java Test.ref [Ref] POTENTIAL_MATCH"
10047
		);
10048
	} finally {
10049
		deleteResource(jarFile);
10050
		removeClasspathEntry(JAVA_PROJECT, new Path(jarPath));
10051
	}
10052
}
10053
10054
/**
10006
 * @bug 228464: Annotation.getMemberValuePairs() empty for single attribute with empty value
10055
 * @bug 228464: Annotation.getMemberValuePairs() empty for single attribute with empty value
10007
 * @test Ensure that annotation are correctly recovered
10056
 * @test Ensure that annotation are correctly recovered
10008
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464"
10057
 * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=228464"
(-)search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java (-2 / +8 lines)
Lines 1566-1575 Link Here
1566
		if (unit.isEmpty()) {
1566
		if (unit.isEmpty()) {
1567
			if (this.currentPossibleMatch.openable instanceof ClassFile) {
1567
			if (this.currentPossibleMatch.openable instanceof ClassFile) {
1568
				ClassFile classFile = (ClassFile) this.currentPossibleMatch.openable;
1568
				ClassFile classFile = (ClassFile) this.currentPossibleMatch.openable;
1569
				IBinaryType info = getBinaryInfo(classFile, classFile.resource());
1569
				IBinaryType info = null;
1570
				try {
1571
					info = getBinaryInfo(classFile, classFile.resource());
1572
				}
1573
				catch (CoreException ce) {
1574
					// Do nothing
1575
				}
1570
				if (info != null) {
1576
				if (info != null) {
1571
					boolean mayBeGeneric = this.patternLocator.mayBeGeneric;
1577
					boolean mayBeGeneric = this.patternLocator.mayBeGeneric;
1572
					this.patternLocator.mayBeGeneric = false; // there's no longer generics in class files
1578
					this.patternLocator.mayBeGeneric = false; // there's no longer generic in class files
1573
					try {
1579
					try {
1574
						new ClassFileMatchLocator().locateMatches(this, classFile, info);
1580
						new ClassFileMatchLocator().locateMatches(this, classFile, info);
1575
					}
1581
					}

Return to bug 222284