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

Bug 365620

Summary: Content Model View gets NPE's if an element doesn't exist in the schema
Product: [WebTools] WTP Source Editing Reporter: Karen Butzke <karenfbutzke>
Component: wst.xmlAssignee: Nick Sandonato <nsand.dev>
Status: RESOLVED FIXED QA Contact: Nitin Dahyabhai <thatnitind>
Severity: normal    
Priority: P3 CC: d_a_carver, nsand.dev
Version: 3.4   
Target Milestone: 3.5 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
NPE stack trace none

Description Karen Butzke CLA 2011-12-05 10:51:12 EST
With the new Content Model View open on an xml file, try typing in an element that doesn't exist in the schema. You will get the attached NPE multiple times.
Comment 1 David Carver CLA 2011-12-05 15:16:09 EST
Do you have a stack trace, and maybe a short example that can be used to reproduce the result?
Comment 2 Karen Butzke CLA 2011-12-05 15:33:21 EST
Created attachment 207944 [details]
NPE stack trace

Sorry, forgot to attach the file!

As an example, create a new xml file from an XML schema file. I chose an XML catalog entry and picked http://java.sun.com/xml/ns/j2ee/application_1_4.xsd . In the created xml file, begin to type in a new element "<f" and the attached NPE occurs. This is only if the Content Model view is open.
Comment 3 Karen Butzke CLA 2011-12-05 15:44:58 EST
I'm using e4 platform as well, not sure if that matters. I'm using wtp build 3.4.0-20111201045309
Comment 4 David Carver CLA 2011-12-05 15:46:41 EST
(In reply to comment #2)
> Created attachment 207944 [details]
> NPE stack trace
> 
> Sorry, forgot to attach the file!
> 
> As an example, create a new xml file from an XML schema file. I chose an XML
> catalog entry and picked http://java.sun.com/xml/ns/j2ee/application_1_4.xsd .
> In the created xml file, begin to type in a new element "<f" and the attached
> NPE occurs. This is only if the Content Model view is open.

Okay, so in this case, how do you want it to be displayed in the Content Model?  Should it be displayed as <unknown> or <any>?
Comment 5 Karen Butzke CLA 2012-01-12 16:47:19 EST
Seems I never responded to this, mainly because it doesn't really matter to me what is displayed in this case. Not sure what the functiuonal requirements should be. I just wanted to report that I was seeing this NPE which is easy to hit if you are hand editing an xml file. I will say that I like the new view overall!
Comment 6 Nick Sandonato CLA 2013-01-09 16:29:50 EST
Added a warning message to the view when the selected element is not in the content model.