Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 311732

Summary: IVirtualComponent.getReferences() problem with legacy metadata
Product: [WebTools] WTP Common Tools Reporter: Chuck Bridgham <cbridgha>
Component: wst.commonAssignee: Chuck Bridgham <cbridgha>
Status: RESOLVED DUPLICATE QA Contact: Carl Anderson <ccc>
Severity: normal    
Priority: P3 Flags: ccc: review+
Version: 3.2   
Target Milestone: 3.2 RC1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch none

Description Chuck Bridgham CLA 2010-05-05 10:21:10 EDT
Recently it was discovered on older workspaces, the component references didn't capture the "archiveName" element, and the method above didn't protect itself in this scenario.

The following exceptions were being thrown because the archive wasn't found  

!ENTRY org.eclipse.wst.common.modulecore 4 0 2010-05-05 10:09:16.078
!MESSAGE 
!STACK 0
java.lang.NullPointerException
	at org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities.getDefaultArchiveName(VirtualReferenceUtilities.java:71)
	at org.eclipse.wst.common.componentcore.internal.util.VirtualReferenceUtilities.ensureReferencesHaveNames(VirtualReferenceUtilities.java:60)
	at org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent.customizeCreatedReference(EARVirtualComponent.java:97)
	at org.eclipse.wst.common.componentcore.internal.resources.VirtualComponent.getReferences(VirtualComponent.java:396)
	at org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent.getHardReferences(EARVirtualComponent.java:86)
	at org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent.getReferences(EARVirtualComponent.java:180)
	at org.eclipse.jst.j2ee.componentcore.util.EARVirtualComponent.getReferences(EARVirtualComponent.java:209)
	at org.eclipse.wst.common.componentcore.internal.builder.DependencyGraphImpl$GraphUpdateJob$1.run(DependencyGraphImpl.java:352)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at
Comment 1 Chuck Bridgham CLA 2010-05-05 15:54:13 EDT
Created attachment 167216 [details]
patch
Comment 2 Chuck Bridgham CLA 2010-05-05 15:55:25 EDT
Attached patch that correctly places a brace around two calls that should only be called when the reference has proper archive names
Comment 3 Carl Anderson CLA 2010-05-05 17:09:20 EDT
I approve of this patch.
Comment 4 Chuck Bridgham CLA 2010-05-05 20:31:47 EDT
oops... I didn't realize this was just fixed by bug 311208

*** This bug has been marked as a duplicate of bug 311208 ***