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 62481 Details for
Bug 180169
Add protection against missbehaving container (returning null entries)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
180169.txt (text/plain), 6.08 KB, created by
Jerome Lanneluc
on 2007-03-30 08:35:39 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2007-03-30 08:35:39 EDT
Size:
6.08 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/JavaProject.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaProject.java,v >retrieving revision 1.385 >diff -u -r1.385 JavaProject.java >--- model/org/eclipse/jdt/internal/core/JavaProject.java 26 Mar 2007 17:03:14 -0000 1.385 >+++ model/org/eclipse/jdt/internal/core/JavaProject.java 30 Mar 2007 12:31:19 -0000 >@@ -2116,6 +2116,12 @@ > // container was bound > for (int j = 0, containerLength = containerEntries.length; j < containerLength; j++){ > IClasspathEntry resolvedEntry = containerEntries[j]; >+ if (resolvedEntry == null) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ JavaModelManager.getJavaModelManager().verbose_missbehaving_container(this, rawEntry.getPath(), containerEntries); >+ } >+ return false; >+ } > if (isOnClasspathEntry(elementPath, isFolderPath, isPackageFragmentRoot, resolvedEntry)) > return true; > } >@@ -2504,6 +2510,12 @@ > // container was bound > for (int j = 0, containerLength = containerEntries.length; j < containerLength; j++){ > ClasspathEntry cEntry = (ClasspathEntry) containerEntries[j]; >+ if (cEntry == null) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ JavaModelManager.getJavaModelManager().verbose_missbehaving_container(this, rawEntry.getPath(), containerEntries); >+ } >+ break; >+ } > // if container is exported or restricted, then its nested entries must in turn be exported (21749) and/or propagate restrictions > cEntry = cEntry.combineWith((ClasspathEntry) rawEntry); > resolvedEntries.add(cEntry); >@@ -2583,6 +2595,12 @@ > // container was bound > for (int j = 0, containerLength = containerEntries.length; j < containerLength; j++){ > ClasspathEntry cEntry = (ClasspathEntry) containerEntries[j]; >+ if (cEntry == null) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ JavaModelManager.getJavaModelManager().verbose_missbehaving_container(this, rawEntry.getPath(), containerEntries); >+ } >+ break; >+ } > // if container is exported or restricted, then its nested entries must in turn be exported (21749) and/or propagate restrictions > cEntry = cEntry.combineWith((ClasspathEntry) rawEntry); > if (rawReverseMap != null) { >Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v >retrieving revision 1.366 >diff -u -r1.366 JavaModelManager.java >--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 29 Mar 2007 14:59:59 -0000 1.366 >+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 30 Mar 2007 12:31:19 -0000 >@@ -549,6 +549,11 @@ > return false; > } > for (int i = 0, length = newEntries.length; i < length; i++) { >+ if (newEntries[i] == null) { >+ if (CP_RESOLVE_VERBOSE) >+ verbose_missbehaving_container(project, containerPath, newEntries); >+ return false; >+ } > if (!newEntries[i].equals(oldEntries[i])) { > if (CP_RESOLVE_VERBOSE) > verbose_missbehaving_container(containerPath, projects, respectiveContainers, container, newEntries, oldEntries); >@@ -625,6 +630,29 @@ > "\n }"); //$NON-NLS-1$ > } > >+ void verbose_missbehaving_container(IJavaProject project, IPath containerPath, IClasspathEntry[] classpathEntries) { >+ Util.verbose( >+ "CPContainer GET - missbehaving container (returning null classpath entry)\n" + //$NON-NLS-1$ >+ " project: " + project.getElementName() + '\n' + //$NON-NLS-1$ >+ " container path: " + containerPath + '\n' + //$NON-NLS-1$ >+ " classpath entries: {\n" + //$NON-NLS-1$ >+ org.eclipse.jdt.internal.compiler.util.Util.toString( >+ classpathEntries, >+ new org.eclipse.jdt.internal.compiler.util.Util.Displayable(){ >+ public String displayString(Object o) { >+ StringBuffer buffer = new StringBuffer(" "); //$NON-NLS-1$ >+ if (o == null) { >+ buffer.append("<null>"); //$NON-NLS-1$ >+ return buffer.toString(); >+ } >+ buffer.append(o); >+ return buffer.toString(); >+ } >+ }) + >+ "\n }" //$NON-NLS-1$ >+ ); >+ } >+ > private void containerRemoveInitializationInProgress(IJavaProject project, IPath containerPath) { > Map initializations = (Map)this.containerInitializationInProgress.get(); > if (initializations == null) >@@ -2228,7 +2256,7 @@ > buffer.append(" container: "+container.getDescription()+" {\n"); //$NON-NLS-2$//$NON-NLS-1$ > IClasspathEntry[] entries = container.getClasspathEntries(); > if (entries != null){ >- for (int i = 0; i < entries.length; i++){ >+ for (int i = 0; i < entries.length; i++) { > buffer.append(" " + entries[i] + '\n'); //$NON-NLS-1$ > } > } >Index: model/org/eclipse/jdt/internal/core/JavaElement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaElement.java,v >retrieving revision 1.123 >diff -u -r1.123 JavaElement.java >--- model/org/eclipse/jdt/internal/core/JavaElement.java 20 Oct 2006 18:10:51 -0000 1.123 >+++ model/org/eclipse/jdt/internal/core/JavaElement.java 30 Mar 2007 12:31:18 -0000 >@@ -659,7 +659,13 @@ > if (container != null) { > IClasspathEntry[] entries= container.getClasspathEntries(); > for (int i= 0; i < entries.length; i++) { >- IClasspathEntry curr= entries[i]; >+ IClasspathEntry curr = entries[i]; >+ if (curr == null) { >+ if (JavaModelManager.CP_RESOLVE_VERBOSE) { >+ JavaModelManager.getJavaModelManager().verbose_missbehaving_container(jproject, containerPath, entries); >+ } >+ break; >+ } > IClasspathEntry resolved= JavaCore.getResolvedClasspathEntry(curr); > if (resolved != null && libPath.equals(resolved.getPath())) { > return curr; // return the real entry
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 180169
: 62481