This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 77837 - NPE when invalid schema opens
Summary: NPE when invalid schema opens
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Model (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P1 blocker (vote)
Assignee: Nam Nguyen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-13 15:36 UTC by Andrei Chistiakov
Modified: 2006-07-03 12:01 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrei Chistiakov 2006-06-13 15:36:07 UTC
Reproduced in build 060613.

To reproduce the bug open the following schema:

<?xml version="1.0" encoding="UTF-8"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
            targetNamespace="http://xml.netbeans.org/examples/targetNS"
            xmlns:tns="http://xml.netbeans.org/examples/targetNS"
            elementFormDefault="qualified">

    <xsd:element name="purchaseOrder" type="tns:PurchaseOrderType"/>
        <xsd:complexType>
            <xsd:sequence/>
        </xsd:complexType>
    
    <xsd:complexType name="PurchaseOrderType">
        <xsd:sequence>
        </xsd:sequence>
    </xsd:complexType>
</xsd:schema>

NPE throws with the following details:

java.lang.NullPointerException
	at
org.netbeans.modules.xml.schema.model.visitor.FindGlobalReferenceVisitor.findReference(FindGlobalReferenceVisitor.java:91)
	at
org.netbeans.modules.xml.schema.model.visitor.FindGlobalReferenceVisitor.visit(FindGlobalReferenceVisitor.java:81)
	at
org.netbeans.modules.xml.schema.model.impl.GlobalComplexTypeImpl.accept(GlobalComplexTypeImpl.java:108)
	at
org.netbeans.modules.xml.schema.model.visitor.FindGlobalReferenceVisitor.visit(FindGlobalReferenceVisitor.java:55)
	at org.netbeans.modules.xml.schema.model.impl.SchemaImpl.accept(SchemaImpl.java:82)
	at
org.netbeans.modules.xml.schema.model.visitor.FindGlobalReferenceVisitor.find(FindGlobalReferenceVisitor.java:48)
	at
org.netbeans.modules.xml.schema.model.impl.GlobalReferenceImpl.get(GlobalReferenceImpl.java:62)
	at
org.netbeans.modules.xml.schema.model.impl.GlobalReferenceImpl.get(GlobalReferenceImpl.java:33)
	at
org.netbeans.modules.xml.schema.ui.nodes.categorized.AdvancedGlobalElementNode.getHtmlDisplayName(AdvancedGlobalElementNode.java:96)
	at
org.openide.explorer.view.VisualizerNode.getHtmlDisplayName(VisualizerNode.java:512)
	at
org.openide.explorer.view.NodeRenderer.getTreeCellRendererComponent(NodeRenderer.java:100)
	at
javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:2693)
	at
javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:475)
	at
javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1342)
	at
javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.getXOrigin(VariableHeightLayoutCache.java:1125)
	at
javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.getNodeBounds(VariableHeightLayoutCache.java:1112)
	at
javax.swing.tree.VariableHeightLayoutCache.getBounds(VariableHeightLayoutCache.java:202)
	at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1162)
	at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
	at javax.swing.JComponent.paintComponent(JComponent.java:742)
	at javax.swing.JComponent.paint(JComponent.java:1005)
	at org.openide.explorer.view.TreeView$ExplorerTree.access$1101(TreeView.java:1395)
	at org.openide.explorer.view.TreeView$ExplorerTree.guardedPaint(TreeView.java:1529)
	at org.openide.explorer.view.TreeView$ExplorerTree.access$1400(TreeView.java:1395)
	at
org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.run(TreeView.java:1809)
	at org.openide.util.Mutex.readAccess(Mutex.java:221)
	at
org.openide.explorer.view.TreeView$ExplorerTree$GuardedActions.<init>(TreeView.java:1803)
	at org.openide.explorer.view.TreeView$ExplorerTree.paint(TreeView.java:1506)
	at javax.swing.JComponent.paintChildren(JComponent.java:842)
	at javax.swing.JComponent.paint(JComponent.java:1014)
	at javax.swing.JViewport.paint(JViewport.java:728)
	at javax.swing.JComponent.paintChildren(JComponent.java:842)
	at javax.swing.JComponent.paint(JComponent.java:1014)
	at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4963)
	at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916)
	at javax.swing.JComponent._paintImmediately(JComponent.java:4859)
	at javax.swing.JComponent.paintImmediately(JComponent.java:4666)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
[catch] at
javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:114)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
	at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 1 Nam Nguyen 2006-06-13 19:01:59 UTC
Seems to be existing behaviour exposed by new UI code.  Fix would be simple.
Comment 2 Nam Nguyen 2006-06-13 19:03:14 UTC
Fixed.

/cvs/xml/schema/api/src/org/netbeans/modules/xml/schema/model/visitor/FindGlobalReferenceVisitor.java,v
 <--  FindGlobalReferenceVisitor.java
new revision: 1.2.2.4; previous revision: 1.2.2.3
Comment 3 Andrei Chistiakov 2006-07-03 12:01:05 UTC
Verified in build 060630_1.