### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java,v retrieving revision 1.42 diff -u -r1.42 JavaSearchMultipleProjectsTests.java --- src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 16 Mar 2007 18:35:31 -0000 1.42 +++ src/org/eclipse/jdt/core/tests/model/JavaSearchMultipleProjectsTests.java 9 Jan 2008 11:54:15 -0000 @@ -14,11 +14,16 @@ import junit.framework.Test; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jdt.core.*; import org.eclipse.jdt.core.search.*; import org.eclipse.jdt.core.tests.model.AbstractJavaSearchTests.JavaSearchResultCollector; +import org.eclipse.jdt.core.tests.model.AbstractJavaSearchTests.TypeNameMatchCollector; +import org.eclipse.jdt.core.tests.util.Util; /** * Tests the Java search engine accross multiple projects. @@ -918,4 +923,61 @@ deleteProject("P"); } } + +/** + * @bug 211962: [search] NullPointerException when typing search pattern in open type + * @test Ensure that no NPE occurs when an internal JAR file of a non-Java project + * has the same path than an external JAR file which is on a Java project classpath + * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=211962" + */ +public void testBug211962() throws CoreException, IOException { + IPath tmpPath = new Path(getExternalPath()).append("b211962"); + try { + // Create external JAR file + tmpPath.toFile().mkdir(); + IPath externalLibPath = tmpPath.append("lib.jar"); + String[] pathsAndContents = new String[] { + "p/X.java", + "package p;\n" + + "public class X {}" + }; + Util.createJar(pathsAndContents, externalLibPath.toString(), "1.4"); + + // Create simple project with internal JAR file + IProject p1 = createProject(tmpPath.segment(0)); + IPath folderPath = new Path(p1.getName()); + for (int i=1,max=tmpPath.segmentCount(); iWhat's new in this drop

Problem Reports Fixed

-212769 +211962 +[search] NullPointerException when typing search pattern in open type +
212769 SetClasspathOperation no longer adds project for refresh
211718 [1.5][compiler] compiler error with nested enum in class using generics Index: search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java,v retrieving revision 1.57.2.1 diff -u -r1.57.2.1 JavaSearchScope.java --- search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 8 Oct 2007 10:55:37 -0000 1.57.2.1 +++ search/org/eclipse/jdt/internal/core/search/JavaSearchScope.java 9 Jan 2008 11:54:17 -0000 @@ -586,7 +586,9 @@ } if (target instanceof IResource) { IJavaElement element = JavaCore.create((IResource)target); - return (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); + if (element != null) { + return (IPackageFragmentRoot) element.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); + } } if (isJarFile) { return project.getPackageFragmentRoot(this.containerPaths[index]);