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

Bug 345464

Summary: WorkspaceFileHyperlink throws Null Pointer Exception for tag attribute values which contain path to image file
Product: [WebTools] WTP Source Editing Reporter: Daniel Azarov <daniel>
Component: wst.xmlAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: alkazako, nsand.dev, raghunathan.srinivasan
Version: unspecifiedFlags: nsand.dev: pmc_approved? (david_williams)
raghunathan.srinivasan: pmc_approved+
nsand.dev: pmc_approved? (naci.dai)
nsand.dev: pmc_approved? (deboer)
nsand.dev: pmc_approved? (neil.hauge)
nsand.dev: pmc_approved? (kaloyan)
nsand.dev: pmc_approved? (cbridgha)
Target Milestone: 3.3 RC1   
Hardware: PC   
OS: Linux   
Whiteboard: PMC_approved
Attachments:
Description Flags
Stack Trace log
none
XHTML page
none
GIF image
none
patch none

Description Daniel Azarov CLA 2011-05-11 12:31:32 EDT
Build Identifier: I20110310-1119

WorkspaceFileHyperlink throws Null Pointer Exception for tag attribute values contains path to image file, like this: <h:graphicImage value="/img/error.gif" alt="Seam logo"/>

Reproducible: Always

Steps to Reproduce:
1. Create Dynamic Web Project
2. Put home.xhtml to WebContent folder and put error.gif to WebContent/img folder
3. Open home.xhtml file in Web Page Editor
4. Point mouse on "/img/error.gif" tag attribute value and press Ctrl button
FAIL: NullPointerException
Comment 1 Daniel Azarov CLA 2011-05-11 12:33:13 EDT
Created attachment 195388 [details]
Stack Trace log
Comment 2 Daniel Azarov CLA 2011-05-11 12:33:44 EDT
Created attachment 195389 [details]
XHTML page
Comment 3 Daniel Azarov CLA 2011-05-11 12:34:06 EDT
Created attachment 195390 [details]
GIF image
Comment 4 Nick Sandonato CLA 2011-05-11 13:48:46 EDT
Fixed. Thanks for the report and the helpful testcase.
Comment 5 Nick Sandonato CLA 2011-05-11 14:23:37 EDT
Created attachment 195405 [details]
patch
Comment 6 Nick Sandonato CLA 2011-05-11 14:29:20 EDT
Jumped the gun. Need PMC approval.


* Explain why you believe this is a stop-ship defect. Or, if it is a "hotbug" (requested by an adopter) please document it as such.

If someone tries to hyperlink on an attribute that references a file in the workspace that does not have a content describer, you'll get an NPE. The example given is a reference to a GIF in the workspace.

* Is there a work-around? If so, why do you believe the work-around is insufficient?

No

* How has the fix been tested? Is there a test case attached to the bugzilla record? Has a JUnit Test been added?

Ad hoc testing.

* Give a brief technical overview. Who has reviewed this fix?

Because some workspace files do not have a content describer (the attached image is a good example), we must check that one exists before trying to use it to find a default editor.

* What is the risk associated with this fix?

None. It's a null pointer check.
Comment 7 Nick Sandonato CLA 2011-05-11 14:36:57 EDT
Thanks for the review.