Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 86457 Details for
Bug 211962
[search] NullPointerException when typing search pattern in open type
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
v01.txt (text/plain), 5.47 KB, created by
Frederic Fusier
on 2008-01-09 07:23:59 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Frederic Fusier
Created:
2008-01-09 07:23:59 EST
Size:
5.47 KB
patch
obsolete
>### 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(); i<max; i++) { >+ folderPath = folderPath.append(tmpPath.segment(i)); >+ createFolder(folderPath.toString()); >+ } >+ IPath internalLibPath = p1.getParent().getLocation().append(folderPath).append("lib.jar"); >+ Util.createJar(pathsAndContents, internalLibPath.toString(), "1.4"); >+ p1.refreshLocal(IResource.DEPTH_INFINITE, null); >+ >+ // Create java project >+ String libPath = externalLibPath.setDevice(null).toString(); >+ IJavaProject p2 = createJavaProject("P2", new String[] {"src"}, new String[] {"JCL_LIB", libPath }, "bin"); >+ >+ // Search all type names with TypeNameMatchRequestor >+ TypeNameMatchCollector collector = new TypeNameMatchCollector(); >+ new SearchEngine().searchAllTypeNames( >+ null, >+ SearchPattern.R_EXACT_MATCH, >+ new char[] { 'X' }, >+ SearchPattern.R_PREFIX_MATCH, >+ IJavaSearchConstants.TYPE, >+ SearchEngine.createJavaSearchScope(new IJavaElement[] { p2 }), >+ collector, >+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, >+ null); >+ assertSearchResults( >+ "X (not open) [in X.class [in p [in "+libPath+" [in P2]]]]", >+ collector >+ ); >+ } finally { >+ Util.delete(tmpPath.toString()); >+ deleteProject(tmpPath.segment(0)); >+ deleteProject("P2"); >+ } >+} > } >#P org.eclipse.jdt.core >Index: buildnotes_jdt-core.html >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v >retrieving revision 1.5933.2.68 >diff -u -r1.5933.2.68 buildnotes_jdt-core.html >--- buildnotes_jdt-core.html 18 Dec 2007 18:13:11 -0000 1.5933.2.68 >+++ buildnotes_jdt-core.html 9 Jan 2008 11:54:17 -0000 >@@ -54,7 +54,9 @@ > <h2>What's new in this drop</h2> > > <h3>Problem Reports Fixed</h3> >-<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=212769">212769</a> >+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=211962">211962</a> >+[search] NullPointerException when typing search pattern in open type >+<br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=212769">212769</a> > SetClasspathOperation no longer adds project for refresh > <br><a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=211718">211718</a> > [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]);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 211962
: 86457