Grasia/ingenme

Visual Representation and null values

Opened this issue · 0 comments

Using Visual Representation for fields of entities that can be null doesn't work properly when the fields are references to entities. Initially they do, but once a value is set it cannot be unset (unlink) and a exception is thrown:

[java] java.lang.NullPointerException
[java] at ingenias.editor.editiondialog.GeneralEditionPanel.setValue(GeneralEditionPanel.java:1249)
[java] at ingenias.editor.editiondialog.GeneralEditionPanel.access$200(GeneralEditionPanel.java:93)
[java] at ingenias.editor.editiondialog.GeneralEditionPanel$4.actionPerformed(GeneralEditionPanel.java:582)
[java] at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
[java] at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
[java] at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
[java] at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
[java] at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
[java] at java.awt.Component.processMouseEvent(Component.java:6533)
[java] at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
[java] at java.awt.Component.processEvent(Component.java:6298)
[java] at java.awt.Container.processEvent(Container.java:2236)
[java] at java.awt.Component.dispatchEventImpl(Component.java:4889)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2294)
[java] at java.awt.Component.dispatchEvent(Component.java:4711)
[java] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
[java] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)
[java] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
[java] at java.awt.Container.dispatchEventImpl(Container.java:2280)
[java] at java.awt.Window.dispatchEventImpl(Window.java:2746)
[java] at java.awt.Component.dispatchEvent(Component.java:4711)
[java] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
[java] at java.awt.EventQueue.access$500(EventQueue.java:97)
[java] at java.awt.EventQueue$3.run(EventQueue.java:709)
[java] at java.awt.EventQueue$3.run(EventQueue.java:703)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
[java] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
[java] at java.awt.EventQueue$4.run(EventQueue.java:731)
[java] at java.awt.EventQueue$4.run(EventQueue.java:729)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
[java] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
[java] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

For example:

<panel Background="white" HorizontalAlignment="CENTER" layout="FlowLayout(FlowLayout.CENTER,0,0)" >
<label id="HumanTarget"/>
</panel>

Nothing is shown while HumanTarget field is null. But once you set a value for the field, you can't unlink and the above exception is thrown.