java.lang.NullPointerException in VE [message #128547] |
Wed, 12 July 2006 09:44  |
Eclipse User |
|
|
|
Originally posted by: steven.arnott.philips.com
Hi,
I recently opened an Java GUI project with Eclipse 3.2
(VE 1.2, GEF 3.2, EMF 2.2.0) on a Windows XP platform..
(JDK 1.5.0_07)
The main GUI display properly with Eclipse 3.2..
However now I get:
java.lang.NullPointerException
at
org.eclipse.ve.internal.java.codegen.model.BeanPart.getSimpl eName(BeanPart.java:273)
at
org.eclipse.ve.internal.java.codegen.model.BeanPart.getImpli citName(BeanPart.java:282)
at
org.eclipse.ve.internal.java.codegen.model.BeanPart.getSimpl eName(BeanPart.java:276)
at
org.eclipse.ve.internal.java.codegen.model.BeanDeclModel.get UnreferencedBeanParts(BeanDeclModel.java:791)
at
org.eclipse.ve.internal.java.codegen.core.JavaSourceTranslat or.buildCompositionModel(JavaSourceTranslator.java:765)
at
org.eclipse.ve.internal.java.codegen.core.JavaSourceTranslat or.reverseParse(JavaSourceTranslator.java:874)
at
org.eclipse.ve.internal.java.codegen.core.JavaSourceTranslat or.decodeDocument(JavaSourceTranslator.java:947)
at
org.eclipse.ve.internal.java.codegen.core.JavaSourceTranslat or.loadModel(JavaSourceTranslator.java:597)
at
org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart$Setup.run(JavaVisualEditorPart.java:1978)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
Any ideas what I should look for in the code?
Steven
|
|
|
|
|
|
Re: java.lang.NullPointerException in VE [message #128786 is a reply to message #128610] |
Thu, 13 July 2006 10:32   |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
This is due to an outstanding bug where we were too aggressive in
parsing code.
It looks weird but change the code:
if (metaFile.exists() && metaFile.canRead()) {
myMDGui.getMyMDI().initaliseMDI(false,metaFile,topCell.getNa me());
} else {
myMDGui.getMyMDI().initaliseMDI(true,metaFile,topCell.getNam e());
}
to:
if (false)
;
else if (metaFile.exists() && metaFile.canRead()) {
myMDGui.getMyMDI().initaliseMDI(false,metaFile,topCell.getNa me());
} else {
myMDGui.getMyMDI().initaliseMDI(true,metaFile,topCell.getNam e());
}
We don't parse the "else" clause of if statements. The
myMDGui.getMyMDI() was causing problems. So by using this code pattern
it is put into the else clause so that the VE won't parse it. But at
runtime it will work fine. The compiler is smart enough to compile out
the if (false) ; part and just go right to the else clause.
--
Thanks,
Rich Kulp
|
|
|
|
|
|
Re: java.lang.NullPointerException in VE [message #133266 is a reply to message #133254] |
Fri, 17 November 2006 12:59   |
Eclipse User |
|
|
|
Originally posted by: rjohns.nortel-no-spam.com
Rick Johns wrote:
> Rich Kulp wrote:
>> Somebody else just had this problem.
>> Do you have code that looks something like this:
>>
>> JECFrame extends JFrame {
>> private JECFrame thisFrame = null;
>>
>> JECFrame() {
>> thisFrame = this;
>> ...
>> }
>>
>> somemethod() {
>> thisFrame.getRootPanel()....
>> }
>> }
>>
>> If you do, get rid of thisFrame and use this. in its place everywhere
>> that you were using thisFrame.
>>
>> If not, please send me a copy of the class. You can send directly to
>> me, you don't need to attach to the newsgroup.
>
> I had something like that in mine where static methods referred to
> thisFrame and a couple non-static methods did, too. But changing the
> non-static methods to just call "getRootPanel()" etc. didn't help. The
> VE just shows a red X over 'this-"JFrame"' and
> 'java.lang.NullPointerException(null)' at the bottom of the window.
>
> Is there a way to get more detail on the exception?
>
> This is on Linux with Java 1.5.0_07 in eclipse 3.2.1. VE
> 1.2.0.v20060518_RC1. I just installed it this week, is it really still
> RC1?
>
Oops, found the log:
eclipse.buildId=M20060629-1905
java.version=1.5.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86
Error
Fri Nov 17 12:40:47 EST 2006
Failed to execute runnable (java.lang.NullPointerException)
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:3374)
at org.eclipse.swt.SWT.error(SWT.java:3297)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:126)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3143)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2845)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.NullPointerException
at
org.eclipse.ve.internal.java.core.BeanPropertyDescriptorAdap ter.isReadOnly(BeanPropertyDescriptorAdapter.java:463)
at
org.eclipse.ve.internal.propertysheet.AbstractPropertySheetE ntry.refreshChildEntries(AbstractPropertySheetEntry.java:803 )
at
org.eclipse.ve.internal.propertysheet.AbstractPropertySheetE ntry.setValues(AbstractPropertySheetEntry.java:1029)
at
org.eclipse.ui.views.properties.PropertySheetViewer.setInput (PropertySheetViewer.java:943)
at
org.eclipse.ui.views.properties.PropertySheetPage.selectionC hanged(PropertySheetPage.java:473)
at
org.eclipse.ve.internal.propertysheet.EToolsPropertySheetPag e.superSelectionChanged(EToolsPropertySheetPage.java:250)
at
org.eclipse.ve.internal.propertysheet.EToolsPropertySheetPag e.access$2(EToolsPropertySheetPage.java:243)
at
org.eclipse.ve.internal.propertysheet.EToolsPropertySheetPag e$1.run(EToolsPropertySheetPage.java:236)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
.... 20 more
--
Cheers,
Rick
|
|
|
|
|
|
|
Re: java.lang.NullPointerException in VE [message #133665 is a reply to message #133653] |
Tue, 28 November 2006 10:14  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Rick is right. The best approach is MVC. Don't put business logic into
the UI. The UI should be simply handling display and sending events. Any
logic to control the UI should be in another class. This isn't only the
best for the VE, it is in general the best pattern to use.
Rick Johns wrote:
> Tiago wrote:
>> Nevermind, i already found the error. Thanks anyway.
>
> I found that by moving to a strict Model-View-Controller design anything
> that's going to confuse VE is no longer in a Java bean. Haven't had any
> problems since. Of course, the first problem seemed to be due to a line
> getting generated twice when updating a property so presumably that
> could happen again.
>
> Should this be a FAQ? Something like:
>
> Q: How do I avoid getting NullPointerExceptions when updating the
> generated code manually?
>
> A: VE can get confused when you manipulate bean properties without
> going through the Properties editor. Move those operations to a class
> in another file and call its methods from the bean.
>
--
Thanks,
Rich Kulp
|
|
|
Re: java.lang.NullPointerException in VE [message #613528 is a reply to message #128547] |
Wed, 12 July 2006 10:06  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Somebody else just had this problem.
Do you have code that looks something like this:
JECFrame extends JFrame {
private JECFrame thisFrame = null;
JECFrame() {
thisFrame = this;
...
}
somemethod() {
thisFrame.getRootPanel()....
}
}
If you do, get rid of thisFrame and use this. in its place everywhere
that you were using thisFrame.
If not, please send me a copy of the class. You can send directly to me,
you don't need to attach to the newsgroup.
--
Thanks,
Rich Kulp
|
|
|
Re: java.lang.NullPointerException in VE [message #613529 is a reply to message #128585] |
Wed, 12 July 2006 10:20  |
Eclipse User |
|
|
|
Originally posted by: steven.arnott.philips.com
HI Rich,
The GUI was built with Eclipse from scratch, so I don't believe that it
does what your suggest...
Due to company "firewall" rules I'm reading this via the Eclipse.org web
interface, so not sure where to get your email address from?
Steven
Rich Kulp wrote:
> Somebody else just had this problem.
> Do you have code that looks something like this:
> JECFrame extends JFrame {
> private JECFrame thisFrame = null;
> JECFrame() {
> thisFrame = this;
> ...
> }
> somemethod() {
> thisFrame.getRootPanel()....
> }
> }
> If you do, get rid of thisFrame and use this. in its place everywhere
> that you were using thisFrame.
> If not, please send me a copy of the class. You can send directly to me,
> you don't need to attach to the newsgroup.
|
|
|
|
Re: java.lang.NullPointerException in VE [message #613544 is a reply to message #128610] |
Thu, 13 July 2006 10:32  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
This is due to an outstanding bug where we were too aggressive in
parsing code.
It looks weird but change the code:
if (metaFile.exists() && metaFile.canRead()) {
myMDGui.getMyMDI().initaliseMDI(false,metaFile,topCell.getNa me());
} else {
myMDGui.getMyMDI().initaliseMDI(true,metaFile,topCell.getNam e());
}
to:
if (false)
;
else if (metaFile.exists() && metaFile.canRead()) {
myMDGui.getMyMDI().initaliseMDI(false,metaFile,topCell.getNa me());
} else {
myMDGui.getMyMDI().initaliseMDI(true,metaFile,topCell.getNam e());
}
We don't parse the "else" clause of if statements. The
myMDGui.getMyMDI() was causing problems. So by using this code pattern
it is put into the else clause so that the VE won't parse it. But at
runtime it will work fine. The compiler is smart enough to compile out
the if (false) ; part and just go right to the else clause.
--
Thanks,
Rich Kulp
|
|
|
|
Re: java.lang.NullPointerException in VE [message #614787 is a reply to message #128836] |
Thu, 16 November 2006 14:51  |
Eclipse User |
|
|
|
Hi
I have encountered the same exception although my situation is rather
different.
I have a member variable which is an instance of the bean containing the
bean failing to parse (ie the Parent Panel). As soon as I declare that
member variable and initialise it to null I get this exception.
Any ideas?
Regards
|
|
|
Re: java.lang.NullPointerException in VE [message #614789 is a reply to message #128585] |
Fri, 17 November 2006 10:39  |
Eclipse User |
|
|
|
Originally posted by: rjohns.nortel-no-spam.com
Rich Kulp wrote:
> Somebody else just had this problem.
> Do you have code that looks something like this:
>
> JECFrame extends JFrame {
> private JECFrame thisFrame = null;
>
> JECFrame() {
> thisFrame = this;
> ...
> }
>
> somemethod() {
> thisFrame.getRootPanel()....
> }
> }
>
> If you do, get rid of thisFrame and use this. in its place everywhere
> that you were using thisFrame.
>
> If not, please send me a copy of the class. You can send directly to me,
> you don't need to attach to the newsgroup.
I had something like that in mine where static methods referred to
thisFrame and a couple non-static methods did, too. But changing the
non-static methods to just call "getRootPanel()" etc. didn't help. The
VE just shows a red X over 'this-"JFrame"' and
'java.lang.NullPointerException(null)' at the bottom of the window.
Is there a way to get more detail on the exception?
This is on Linux with Java 1.5.0_07 in eclipse 3.2.1. VE
1.2.0.v20060518_RC1. I just installed it this week, is it really still RC1?
--
Cheers,
Rick
|
|
|
Re: java.lang.NullPointerException in VE [message #614790 is a reply to message #133254] |
Fri, 17 November 2006 12:59  |
Eclipse User |
|
|
|
Originally posted by: rjohns.nortel-no-spam.com
Rick Johns wrote:
> Rich Kulp wrote:
>> Somebody else just had this problem.
>> Do you have code that looks something like this:
>>
>> JECFrame extends JFrame {
>> private JECFrame thisFrame = null;
>>
>> JECFrame() {
>> thisFrame = this;
>> ...
>> }
>>
>> somemethod() {
>> thisFrame.getRootPanel()....
>> }
>> }
>>
>> If you do, get rid of thisFrame and use this. in its place everywhere
>> that you were using thisFrame.
>>
>> If not, please send me a copy of the class. You can send directly to
>> me, you don't need to attach to the newsgroup.
>
> I had something like that in mine where static methods referred to
> thisFrame and a couple non-static methods did, too. But changing the
> non-static methods to just call "getRootPanel()" etc. didn't help. The
> VE just shows a red X over 'this-"JFrame"' and
> 'java.lang.NullPointerException(null)' at the bottom of the window.
>
> Is there a way to get more detail on the exception?
>
> This is on Linux with Java 1.5.0_07 in eclipse 3.2.1. VE
> 1.2.0.v20060518_RC1. I just installed it this week, is it really still
> RC1?
>
Oops, found the log:
eclipse.buildId=M20060629-1905
java.version=1.5.0_07
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Command-line arguments: -os linux -ws gtk -arch x86
Error
Fri Nov 17 12:40:47 EST 2006
Failed to execute runnable (java.lang.NullPointerException)
org.eclipse.swt.SWTException: Failed to execute runnable
(java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:3374)
at org.eclipse.swt.SWT.error(SWT.java:3297)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:126)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3143)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2845)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.NullPointerException
at
org.eclipse.ve.internal.java.core.BeanPropertyDescriptorAdap ter.isReadOnly(BeanPropertyDescriptorAdapter.java:463)
at
org.eclipse.ve.internal.propertysheet.AbstractPropertySheetE ntry.refreshChildEntries(AbstractPropertySheetEntry.java:803 )
at
org.eclipse.ve.internal.propertysheet.AbstractPropertySheetE ntry.setValues(AbstractPropertySheetEntry.java:1029)
at
org.eclipse.ui.views.properties.PropertySheetViewer.setInput (PropertySheetViewer.java:943)
at
org.eclipse.ui.views.properties.PropertySheetPage.selectionC hanged(PropertySheetPage.java:473)
at
org.eclipse.ve.internal.propertysheet.EToolsPropertySheetPag e.superSelectionChanged(EToolsPropertySheetPage.java:250)
at
org.eclipse.ve.internal.propertysheet.EToolsPropertySheetPag e.access$2(EToolsPropertySheetPage.java:243)
at
org.eclipse.ve.internal.propertysheet.EToolsPropertySheetPag e$1.run(EToolsPropertySheetPage.java:236)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
.... 20 more
--
Cheers,
Rick
|
|
|
Re: java.lang.NullPointerException in VE [message #614791 is a reply to message #133254] |
Fri, 17 November 2006 13:18  |
Eclipse User |
|
|
|
Originally posted by: rjohns.nortel-no-spam.com
Rick Johns wrote:
[...]>
> I had something like that in mine where static methods referred to
> thisFrame and a couple non-static methods did, too. But changing the
> non-static methods to just call "getRootPanel()" etc. didn't help. The
> VE just shows a red X over 'this-"JFrame"' and
> 'java.lang.NullPointerException(null)' at the bottom of the window.
>
> Is there a way to get more detail on the exception?
>
> This is on Linux with Java 1.5.0_07 in eclipse 3.2.1. VE
> 1.2.0.v20060518_RC1. I just installed it this week, is it really still
> RC1?
>
OK, I seem to have cleared it up. I found this generated code:
private JScrollPane getR6GuiCommandOutputScrollPane()
{
if (r6GuiCommandOutputScrollPane == null) {
r6GuiCommandOutputScrollPane = new JScrollPane();
r6GuiCommandOutputScrollPane.setPreferredSize(new
Dimension(733, 182));
r6GuiCommandOutputScrollPane.setViewportView(getCommandOutpu t());
r6GuiCommandOutputScrollPane.setComponentOrientation(Compone ntOrientation.LEFT_TO_RIGHT);
r6GuiCommandOutputScrollPane.setComponentOrientation(Compone ntOrientation.LEFT_TO_RIGHT);
}
return r6GuiCommandOutputScrollPane;
}
I deleted the second setComponentOrientation() line. That caused
another NullPointerException and nothing at all could be displayed in
the VE. I restored the line and opened the JFrame in VE again, and it
seems OK now. What's that about?
--
Cheers,
Rick
|
|
|
Re: java.lang.NullPointerException in VE [message #614798 is a reply to message #128547] |
Thu, 23 November 2006 07:16  |
Eclipse User |
|
|
|
Hi There,
i'm having the same problem with VE, but it happens with any swing VE class. I'm under windows 2000, JDK 1.5.0_09 and eclipse 3.2. I'm sending the log file below. Any ideas?
!ENTRY org.eclipse.ve.java.core 2 0 2006-11-23 10:15:47.281
!MESSAGE
+++ Warning +++: Thu Nov 23 10:15:47 GMT-03:00 2006 Skipping expression: jContentPane.setLayout(null)
!ENTRY org.eclipse.ve.java.core 4 0 2006-11-23 10:15:47.281
!MESSAGE Invalid PropertyDecorator
!ENTRY org.eclipse.ve.java.core 4 0 2006-11-23 10:15:47.781
!MESSAGE Exception thrown.
!STACK 0
java.lang.NullPointerException
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:779)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1115)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:610)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:595)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:587)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:582)
at org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createLayoutEditPolicy(ContainerGraphicalEditPart.java:83)
at org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createEditPolicies(ContainerGraphicalEditPart.java:69)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:230)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:212)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
at org.eclipse.ve.internal.cde.core.CDEAbstractGraphicalEditPar t.refresh(CDEAbstractGraphicalEditPart.java:338)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:212)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
at org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.setRootModel(JavaVisualEditorPart.java:504)
at org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.initializeViewers(JavaVisualEditorPart.java:1121)
at org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart$13.run(JavaVisualEditorPart.java:2098)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3325)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2971)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
!ENTRY org.eclipse.ve.java.core 4 0 2006-11-23 10:15:47.796
!MESSAGE Exception thrown.
!STACK 0
java.lang.NullPointerException
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:779)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1115)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:833)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eIsSet(BasicEObj ectImpl.java:818)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1103)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2458)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:1032)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElement(XMLSa veImpl.java:918)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveContainedMany (XMLSaveImpl.java:2178)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveFeatures(XMLS aveImpl.java:1386)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.saveElementID(XML SaveImpl.java:2458)
at org.eclipse.emf.ecore.xmi.impl.XMISaveImpl.writeTopObjects(X MISaveImpl.java:86)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.traverse(XMLSaveI mpl.java:553)
at org.eclipse.emf.ecore.xmi.impl.XMLSaveImpl.save(XMLSaveImpl. java:233)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doSave(XMLRes ourceImpl.java:203)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:993)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(Resour ceImpl.java:881)
at org.eclipse.ve.internal.java.codegen.util.VEModelCacheUtilit y.doSaveCache(VEModelCacheUtility.java:158)
at org.eclipse.ve.internal.java.codegen.core.JavaSourceTranslat or.primDoSave(JavaSourceTranslator.java:1397)
at org.eclipse.ve.internal.java.codegen.core.JavaSourceTranslat or.doSave(JavaSourceTranslator.java:1411)
at org.eclipse.ve.internal.java.codegen.core.JavaSourceTranslat or$3.doRun(JavaSourceTranslator.java:956)
at org.eclipse.ve.internal.java.codegen.util.ReverseParserJob.r un(ReverseParserJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
!ENTRY org.eclipse.ui 4 4 2006-11-23 10:15:47.796
!MESSAGE Unhandled event loop exception
!ENTRY org.eclipse.ui 4 0 2006-11-23 10:15:47.796
!MESSAGE Failed to execute runnable (java.lang.NullPointerException)
!STACK 0
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException)
at org.eclipse.swt.SWT.error(SWT.java:3374)
at org.eclipse.swt.SWT.error(SWT.java:3297)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:126)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.jav a:3325)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :2971)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Work bench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.j ava:149)
at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplicatio n.java:95)
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: java.lang.NullPointerException
at org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.getSetting Delegate(EStructuralFeatureImpl.java:779)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSettingDelegate (BasicEObjectImpl.java:1115)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:610)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:595)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:587)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:582)
at org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createLayoutEditPolicy(ContainerGraphicalEditPart.java:83)
at org.eclipse.ve.internal.jfc.core.ContainerGraphicalEditPart. createEditPolicies(ContainerGraphicalEditPart.java:69)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:230)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:212)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
at org.eclipse.ve.internal.cde.core.CDEAbstractGraphicalEditPar t.refresh(CDEAbstractGraphicalEditPart.java:338)
at org.eclipse.gef.editparts.AbstractEditPart.addNotify(Abstrac tEditPart.java:235)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.addNotif y(AbstractGraphicalEditPart.java:212)
at org.eclipse.gef.editparts.AbstractEditPart.addChild(Abstract EditPart.java:198)
at org.eclipse.gef.editparts.AbstractEditPart.refreshChildren(A bstractEditPart.java:727)
at org.eclipse.gef.editparts.AbstractEditPart.refresh(AbstractE ditPart.java:677)
at org.eclipse.gef.editparts.AbstractGraphicalEditPart.refresh( AbstractGraphicalEditPart.java:554)
at org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.setRootModel(JavaVisualEditorPart.java:504)
at org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart.initializeViewers(JavaVisualEditorPart.java:1121)
at org.eclipse.ve.internal.java.codegen.editorpart.JavaVisualEd itorPart$13.run(JavaVisualEditorPart.java:2098)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:3 5)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchr onizer.java:123)
... 20 more
Thanks a lot.
|
|
|
|
Re: java.lang.NullPointerException in VE [message #614820 is a reply to message #133381] |
Tue, 28 November 2006 09:17  |
Eclipse User |
|
|
|
Originally posted by: rjohns.nortel-no-spam.com
Tiago wrote:
> Nevermind, i already found the error. Thanks anyway.
I found that by moving to a strict Model-View-Controller design anything
that's going to confuse VE is no longer in a Java bean. Haven't had any
problems since. Of course, the first problem seemed to be due to a line
getting generated twice when updating a property so presumably that
could happen again.
Should this be a FAQ? Something like:
Q: How do I avoid getting NullPointerExceptions when updating the
generated code manually?
A: VE can get confused when you manipulate bean properties without
going through the Properties editor. Move those operations to a class
in another file and call its methods from the bean.
--
Cheers,
Rick
|
|
|
Re: java.lang.NullPointerException in VE [message #614821 is a reply to message #133653] |
Tue, 28 November 2006 10:14  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Rick is right. The best approach is MVC. Don't put business logic into
the UI. The UI should be simply handling display and sending events. Any
logic to control the UI should be in another class. This isn't only the
best for the VE, it is in general the best pattern to use.
Rick Johns wrote:
> Tiago wrote:
>> Nevermind, i already found the error. Thanks anyway.
>
> I found that by moving to a strict Model-View-Controller design anything
> that's going to confuse VE is no longer in a Java bean. Haven't had any
> problems since. Of course, the first problem seemed to be due to a line
> getting generated twice when updating a property so presumably that
> could happen again.
>
> Should this be a FAQ? Something like:
>
> Q: How do I avoid getting NullPointerExceptions when updating the
> generated code manually?
>
> A: VE can get confused when you manipulate bean properties without
> going through the Properties editor. Move those operations to a class
> in another file and call its methods from the bean.
>
--
Thanks,
Rich Kulp
|
|
|