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 160109 Details for
Bug 246650
[model] o.e.jdt.core.dom.PackageBinding.getJavaElement throwing IndexOutOfBoundsException
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Tracing code
patch_246650.txt (text/plain), 2.32 KB, created by
Olivier Thomann
on 2010-02-24 14:54:59 EST
(
hide
)
Description:
Tracing code
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-02-24 14:54:59 EST
Size:
2.32 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: dom/org/eclipse/jdt/core/dom/PackageBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/PackageBinding.java,v >retrieving revision 1.41 >diff -u -r1.41 PackageBinding.java >--- dom/org/eclipse/jdt/core/dom/PackageBinding.java 27 Jun 2008 16:03:49 -0000 1.41 >+++ dom/org/eclipse/jdt/core/dom/PackageBinding.java 24 Feb 2010 19:54:19 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2008 IBM Corporation and others. >+ * Copyright (c) 2000, 2010 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -13,10 +13,14 @@ > > import java.util.Iterator; > import java.util.List; >+ >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.Status; > import org.eclipse.jdt.core.ICompilationUnit; > import org.eclipse.jdt.core.IJavaElement; > import org.eclipse.jdt.core.IPackageFragment; > import org.eclipse.jdt.core.IPackageFragmentRoot; >+import org.eclipse.jdt.core.JavaCore; > import org.eclipse.jdt.core.JavaModelException; > > import org.eclipse.jdt.core.compiler.CharOperation; >@@ -191,10 +195,20 @@ > public IJavaElement getJavaElement() { > INameEnvironment nameEnvironment = this.binding.environment.nameEnvironment; // a package binding always has a LooupEnvironment set > if (!(nameEnvironment instanceof SearchableEnvironment)) return null; >+ // this is not true in standalone DOM/AST > NameLookup nameLookup = ((SearchableEnvironment) nameEnvironment).nameLookup; > if (nameLookup == null) return null; > IJavaElement[] pkgs = nameLookup.findPackageFragments(getName(), false/*exact match*/); > if (pkgs == null) return null; >+ if (pkgs.length == 0) { >+ // add additional tracing as this should not happen >+ org.eclipse.jdt.internal.core.util.Util.log( >+ new Status( >+ IStatus.WARNING, >+ JavaCore.PLUGIN_ID, >+ "Searching for package " + getName() + " returns an empty array")); //$NON-NLS-1$ //$NON-NLS-2$ >+ return null; >+ } > return pkgs[0]; > } >
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 246650
: 160109