Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 319923 - NPE in DefaultXMLPartitionFormatter
Summary: NPE in DefaultXMLPartitionFormatter
Status: VERIFIED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.2   Edit
Assignee: Rakesh CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-14 17:19 EDT by Valentin Baciu CLA
Modified: 2010-08-20 14:46 EDT (History)
3 users (show)

See Also:
nsand.dev: review+


Attachments
Full stack trace (5.04 KB, text/plain)
2010-07-14 17:19 EDT, Valentin Baciu CLA
no flags Details
patcha (1.25 KB, patch)
2010-07-22 10:17 EDT, Rakesh CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Valentin Baciu CLA 2010-07-14 17:19:39 EDT
Created attachment 174352 [details]
Full stack trace

I've hit this NPE when executing the follow XML schema editing scenario:
- create a new XML schema file with the New XML Schema wizard
- go to the graphical view
- select the elements compartment in the top level index figure
- right click and add a new element
- click away from the direct edit box to finish adding 
- select the element
- right click and choose remove from the context menu
- go to the source view
- the cursor should be right before the schema element's opening tag angle bracket
- hit Ctrl+Shift+F to format the document
- note the NPE

Here's part of the stack trace (see attachment for the full trace):

java.lang.NullPointerException
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatStartTag(DefaultXMLPartitionFormatter.java:552)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatRegion(DefaultXMLPartitionFormatter.java:438)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.formatSiblings(DefaultXMLPartitionFormatter.java:481)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.format(DefaultXMLPartitionFormatter.java:204)
at org.eclipse.wst.xml.core.internal.formatter.DefaultXMLPartitionFormatter.format(DefaultXMLPartitionFormatter.java:160)
at org.eclipse.wst.xml.ui.internal.XMLFormattingStrategy.format(XMLFormattingStrategy.java:61)
at org.eclipse.jface.text.formatter.MultiPassContentFormatter.formatMaster(MultiPassContentFormatter.java:193)
at org.eclipse.wst.sse.ui.StructuredTextMultiPassContentFormatter.formatMaster(StructuredTextMultiPassContentFormatter.java:56)
at org.eclipse.jface.text.formatter.MultiPassContentFormatter.format(MultiPassContentFormatter.java:142)
at org.eclipse.wst.sse.ui.internal.StructuredTextViewer.doOperation(StructuredTextViewer.java:515)
at org.eclipse.ui.texteditor.TextOperationAction$1.run(TextOperationAction.java:131)

...
Comment 1 Rakesh CLA 2010-07-22 10:17:59 EDT
Created attachment 174980 [details]
patcha

A simple null pointer check seems to solve the issue.
Comment 2 Nick Sandonato CLA 2010-07-28 15:54:12 EDT
Patch looks good to me. Thanks.
Comment 3 Nick Sandonato CLA 2010-08-16 16:18:40 EDT
Fixed in Maintenance and HEAD.
Comment 4 Valentin Baciu CLA 2010-08-20 14:46:31 EDT
Verified with M-3.2.2-20100820035731 and I-3.3.0-20100820155725.