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 153222 Details for
Bug 293861
Problem with refactoring when existing jar with invalid package names
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch.txt (text/plain), 4.78 KB, created by
Satyam Kandula
on 2009-11-27 03:51:42 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Satyam Kandula
Created:
2009-11-27 03:51:42 EST
Size:
4.78 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/PackageFragment.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/PackageFragment.java,v >retrieving revision 1.85 >diff -u -r1.85 PackageFragment.java >--- model/org/eclipse/jdt/internal/core/PackageFragment.java 22 Oct 2009 12:29:08 -0000 1.85 >+++ model/org/eclipse/jdt/internal/core/PackageFragment.java 27 Nov 2009 08:48:31 -0000 >@@ -57,9 +57,18 @@ > > public String[] names; > >+ private static final short NOT_INITIALIZED = -1; >+ >+ private static final short VALID = 0; >+ >+ private static final short INVALID = 1; >+ >+ private short packageValid; >+ > protected PackageFragment(PackageFragmentRoot root, String[] names) { > super(root); > this.names = names; >+ this.packageValid = NOT_INITIALIZED; > } > /** > * @see Openable >@@ -390,14 +399,19 @@ > public boolean isDefaultPackage() { > return this.names.length == 0; > } >-private boolean isValidPackageName() { >+public boolean isValidPackageName() { >+ if (this.packageValid != NOT_INITIALIZED) >+ return (this.packageValid == VALID); > JavaProject javaProject = (JavaProject) getJavaProject(); > String sourceLevel = javaProject.getOption(JavaCore.COMPILER_SOURCE, true); > String complianceLevel = javaProject.getOption(JavaCore.COMPILER_COMPLIANCE, true); > for (int i = 0, length = this.names.length; i < length; i++) { >- if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel)) >+ if (!Util.isValidFolderNameForPackage(this.names[i], sourceLevel, complianceLevel)) { >+ this.packageValid = INVALID; > return false; >+ } > } >+ this.packageValid = VALID; > return true; > } > /** >Index: search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java,v >retrieving revision 1.328 >diff -u -r1.328 MatchLocator.java >--- search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 6 Oct 2009 17:07:18 -0000 1.328 >+++ search/org/eclipse/jdt/internal/core/search/matching/MatchLocator.java 27 Nov 2009 08:48:33 -0000 >@@ -1173,7 +1173,15 @@ > } else { > openable = this.handleFactory.createOpenable(pathString, this.scope); > } >- if (openable == null) { >+ boolean valid = (openable != null); >+ // should not look for classes with invalid package names in jars >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=293861 >+ if (valid && openable.getPackageFragmentRoot().isArchive()) { >+ IJavaElement element = openable.getParent(); >+ if (element instanceof PackageFragment && !((PackageFragment)element).isValidPackageName()) >+ valid = false; >+ } >+ if (!valid) { > if (this.progressMonitor != null) { > this.progressWorked++; > if ((this.progressWorked%this.progressStep)==0) this.progressMonitor.worked(this.progressStep); >#P org.eclipse.jdt.core.tests.model >Index: src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java,v >retrieving revision 1.180 >diff -u -r1.180 JavaSearchBugsTests.java >--- src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 5 Nov 2009 15:11:51 -0000 1.180 >+++ src/org/eclipse/jdt/core/tests/model/JavaSearchBugsTests.java 27 Nov 2009 08:48:42 -0000 >@@ -11026,4 +11026,24 @@ > deleteProject("P"); > } > } >+/** >+ * @bug 293861: Problem with refactoring when existing jar with invalid package names >+ * @test Ensure that the search doesn't return classes with invalid package names >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=293861" >+ */ >+public void testBug293861() throws CoreException { >+ try >+ { >+ IJavaProject project = createJavaProject("P"); >+ addClasspathEntry(project, JavaCore.newLibraryEntry(new Path("/JavaSearchBugs/lib/b293861.jar"), null, null)); >+ int mask = IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SOURCES | IJavaSearchScope.REFERENCED_PROJECTS; >+ IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] { project }, mask); >+ search("testWithoutSource", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, scope); >+ assertSearchResults("No search results expected", "", this.resultCollector); >+ search("testWithSource", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, scope); >+ assertSearchResults("No search results expected", "", this.resultCollector); >+ } finally { >+ deleteProject("P"); >+ } >+} > } >\ No newline at end of file
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
Flags:
frederic_fusier
:
review-
Actions:
View
|
Diff
Attachments on
bug 293861
:
151012
|
151013
|
151410
|
152146
|
153222
|
153223
|
154621
|
154622
|
154957
|
155298
|
155299
|
155300
|
158473
|
158478
|
159164
|
180736
|
180737
|
180738
|
180739