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 79229 Details for
Bug 199229
Error when selecting J2EE Module dependencies
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]
Check for null components
bug199299wtp15patch (text/plain), 6.17 KB, created by
Carl Anderson
on 2007-09-26 14:57:28 EDT
(
hide
)
Description:
Check for null components
Filename:
MIME Type:
Creator:
Carl Anderson
Created:
2007-09-26 14:57:28 EDT
Size:
6.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.common.modulecore >Index: modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/common/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java,v >retrieving revision 1.33.4.1 >diff -u -r1.33.4.1 VirtualResource.java >--- modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java 28 Sep 2006 17:01:20 -0000 1.33.4.1 >+++ modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualResource.java 26 Sep 2007 18:52:51 -0000 >@@ -243,23 +243,27 @@ > public void setResourceType(String aResourceType) { > resourceType = aResourceType; > WorkbenchComponent aComponent = getReadOnlyComponent(); >- ComponentResource[] resources = aComponent.findResourcesByRuntimePath(getRuntimePath()); >- for (int i = 0; i < resources.length; i++) { >- resources[i].setResourceType(aResourceType); >+ if (aComponent != null) { >+ ComponentResource[] resources = aComponent.findResourcesByRuntimePath(getRuntimePath()); >+ for (int i = 0; i < resources.length; i++) { >+ resources[i].setResourceType(aResourceType); >+ } > } >- > } > > // TODO Fetch the resource type from the model. > public String getResourceType() { > if (null == resourceType) { > WorkbenchComponent aComponent = getReadOnlyComponent(); >- ComponentResource[] resources = aComponent.findResourcesByRuntimePath(getRuntimePath()); >- for (int i = 0; i < resources.length; i++) { >- resourceType = resources[i].getResourceType(); >- return resourceType; >+ if (aComponent != null) >+ { >+ ComponentResource[] resources = aComponent >+ .findResourcesByRuntimePath(getRuntimePath()); >+ if (resources.length > 0) { >+ resourceType = resources[0].getResourceType(); >+ return resourceType; >+ } > } >- > } > resourceType = ""; //$NON-NLS-1$ > return resourceType; >@@ -314,8 +318,10 @@ > WorkbenchComponent component = null; > try { > moduleCore = StructureEdit.getStructureEditForRead(getProject()); >- component = moduleCore.getComponent(); >- mapping.mark(getProject(), component); >+ if (moduleCore != null) { >+ component = moduleCore.getComponent(); >+ mapping.mark(getProject(), component); >+ } > } finally { > if (moduleCore != null) { > moduleCore.dispose(); >Index: modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java >=================================================================== >RCS file: /cvsroot/webtools/wst/components/common/plugins/org.eclipse.wst.common.modulecore/modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java,v >retrieving revision 1.32.2.1 >diff -u -r1.32.2.1 VirtualContainer.java >--- modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java 28 Sep 2006 17:01:20 -0000 1.32.2.1 >+++ modulecore-src/org/eclipse/wst/common/componentcore/internal/resources/VirtualContainer.java 26 Sep 2007 18:52:51 -0000 >@@ -26,6 +26,7 @@ > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; >+import org.eclipse.jem.util.logger.proxy.Logger; > import org.eclipse.wst.common.componentcore.ComponentCore; > import org.eclipse.wst.common.componentcore.internal.ComponentResource; > import org.eclipse.wst.common.componentcore.internal.StructureEdit; >@@ -77,29 +78,36 @@ > try { > > structureEdit = StructureEdit.getStructureEditForRead(getProject()); >- WorkbenchComponent component = structureEdit.getComponent(); >- if (null != component) { >- ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component); >- ComponentResource[] resources = root.findModuleResources(getRuntimePath().append(aPath), ResourceTreeNode.CREATE_NONE); >- >- for (int i = 0; i < resources.length; i++) { >- // return the resources corresponding to the root, not any of the children if its a folder >- if (resources[i].getRuntimePath().equals(getRuntimePath().append(aPath))) { >- IResource platformResource = getProject().findMember(resources[i].getSourcePath()); >- if (platformResource == null) >- platformResource = ResourcesPlugin.getWorkspace().getRoot().findMember(resources[i].getSourcePath()); >- if (platformResource != null) { >- switch (platformResource.getType()) { >- case IResource.FOLDER : >- case IResource.PROJECT : >- return ComponentCore.createFolder(getProject(), getRuntimePath().append(aPath)); >- case IResource.FILE : >- return new VirtualFile(getProject(), getRuntimePath().append(aPath)); >+ if (structureEdit != null) // bug 199229 >+ { >+ WorkbenchComponent component = structureEdit.getComponent(); >+ if (null != component) >+ { >+ ResourceTreeRoot root = ResourceTreeRoot.getDeployResourceTreeRoot(component); >+ ComponentResource[] resources = root.findModuleResources(getRuntimePath().append(aPath), ResourceTreeNode.CREATE_NONE); >+ >+ for (int i = 0; i < resources.length; i++) >+ { >+ // return the resources corresponding to the root, not any of the children if its a folder >+ if (resources[i].getRuntimePath().equals(getRuntimePath().append(aPath))) { >+ IResource platformResource = getProject().findMember(resources[i].getSourcePath()); >+ if (platformResource == null) >+ platformResource = ResourcesPlugin.getWorkspace().getRoot().findMember(resources[i].getSourcePath()); >+ if (platformResource != null) >+ { >+ switch (platformResource.getType()) >+ { >+ case IResource.FOLDER : >+ case IResource.PROJECT : >+ return ComponentCore.createFolder(getProject(), getRuntimePath().append(aPath)); >+ case IResource.FILE : >+ return new VirtualFile(getProject(), getRuntimePath().append(aPath)); >+ } >+ } > } > } > } > } >- } > } finally { > if (structureEdit != null) > structureEdit.dispose();
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 199229
:
75648
|
79229
|
79230
|
79350
|
79351