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

Bug 314477

Summary: NPE while editing XSD
Product: [WebTools] WTP Source Editing Reporter: Pascal Rapicault <pascal>
Component: wst.xsdAssignee: Alina Marin <alina>
Status: ASSIGNED --- QA Contact: Keith Chong <keith.chong.ca>
Severity: normal    
Priority: P3 CC: keith.chong.ca, shr31223
Version: unspecified   
Target Milestone: Future   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Added a try catch block to avoid the NPE while setting text none

Description Pascal Rapicault CLA 2010-05-26 10:54:33 EDT
Helios RC1

I was happily modifying an XSD and it ran into this.

java.lang.NullPointerException
at org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDAttributeDeclarationSection.refreshRefCombo(XSDAttributeDeclarationSection.java:831)
at org.eclipse.wst.xsd.ui.internal.common.properties.sections.XSDAttributeDeclarationSection.refresh(XSDAttributeDeclarationSection.java:336)
at org.eclipse.ui.views.properties.tabbed.TabContents$6.run(TabContents.java:217)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.ui.views.properties.tabbed.TabContents.refresh(TabContents.java:220)
at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage.handlePartActivated(TabbedPropertySheetPage.java:341)
at org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage$1.partActivated(TabbedPropertySheetPage.java:118)
at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:72)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.PartListenerList.fireEvent(PartListenerList.java:57)
at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:70)
at org.eclipse.ui.internal.PartService.firePartActivated(PartService.java:187)
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:306)
at org.eclipse.ui.internal.WWinPartService.updateActivePart(WWinPartService.java:135)
at org.eclipse.ui.internal.WWinPartService.access$0(WWinPartService.java:125)
at org.eclipse.ui.internal.WWinPartService$WWinListener.partDeactivated(WWinPartService.java:50)
at org.eclipse.ui.internal.PartListenerList2$4.run(PartListenerList2.java:115)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.core.runtime.Platform.run(Platform.java:888)
at org.eclipse.ui.internal.PartListenerList2.fireEvent(PartListenerList2.java:55)
at org.eclipse.ui.internal.PartListenerList2.firePartDeactivated(PartListenerList2.java:113)
at org.eclipse.ui.internal.PartService.firePartDeactivated(PartService.java:242)
at org.eclipse.ui.internal.PartService.setActivePart(PartService.java:300)
at org.eclipse.ui.internal.WorkbenchPagePartList.fireActivePartChanged(WorkbenchPagePartList.java:57)
at org.eclipse.ui.internal.PartList.setActivePart(PartList.java:136)
at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:3537)
at org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:3077)
at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:279)
at org.eclipse.ui.internal.EditorPane.requestActivation(EditorPane.java:98)
at org.eclipse.ui.internal.PartPane.handleEvent(PartPane.java:237)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:3764)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1343)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1366)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1347)
at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1355)
at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:2948)
at org.eclipse.swt.widgets.Canvas.sendFocusEvent(Canvas.java:62)
at org.eclipse.swt.widgets.Display.checkFocus(Display.java:618)
at org.eclipse.swt.widgets.Shell.makeFirstResponder(Shell.java:1112)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5072)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:220)
at org.eclipse.swt.widgets.Widget.windowSendEvent(Widget.java:1919)
at org.eclipse.swt.widgets.Shell.windowSendEvent(Shell.java:2008)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5026)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method)
at org.eclipse.swt.widgets.Display.applicationSendEvent(Display.java:4568)
at org.eclipse.swt.widgets.Display.applicationProc(Display.java:4645)
at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method)
at org.eclipse.swt.internal.cocoa.NSApplication.sendEvent(NSApplication.java:115)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3262)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Comment 1 Valentin Baciu CLA 2010-07-20 15:37:23 EDT
Hi Pascal, any chance you still have the schema and perhaps remember what you were doing at the time you got the NPE?
Comment 2 Keith Chong CLA 2010-11-03 01:12:28 EDT
Hi Galileo, please have a look at this.
Comment 3 Galileo Perez CLA 2010-11-04 11:46:17 EDT
Created attachment 182389 [details]
Added a try catch block to avoid the NPE while setting text

While the attribute isReference object is null and the code tries to setText it throws an NPE, this exception was avoided adding a try catch block