Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Null Pointer on Anneal Layout (Read 3651 times)
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Null Pointer on Anneal Layout
Nov 1st, 2007 at 1:33pm
Print Post  
Hi,

When running layout.arrang(this) in a flowChart (when layout is an AnnealLayout variable) I got this exception:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.mindfusion.jdiagram.Arrow.i(Unknown Source)
at com.mindfusion.jdiagram.Node$3.a(Unknown Source)
at com.mindfusion.jdiagram.MethodCallVisitor.a(Unknown Source)
at com.mindfusion.jdiagram.Node.a(Unknown Source)
at com.mindfusion.jdiagram.Node.c(Unknown Source)
at com.mindfusion.jdiagram.Node.move(Unknown Source)
at com.mindfusion.jdiagram.FCNode.setBounds(Unknown Source)
at com.mindfusion.jdiagram.jlayout.AnnealLayout.arrange(Unknown Source)
at com.mindfusion.jdiagram.AnnealLayout.arrange(Unknown Source)
at com.precise.autodiscovery.gui.discoverServers.topology.diagram.ADFlowChartImpl.u
pdateFlowChart(ADFlowChartImpl.java:191)
at com.precise.autodiscovery.gui.discoverServers.topology.diagram.DiagramViewPanel.
updateFlowChart(DiagramViewPanel.java:257)
at com.precise.autodiscovery.gui.discoverServers.DiscoverServersTabbedPane$DiagramC
hangeListener.stateChanged(DiscoverServersTabbedPane.java:169)
at javax.swing.JTabbedPane.fireStateChanged(Unknown Source)
at javax.swing.JTabbedPane$ModelListener.stateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.fireStateChanged(Unknown Source)
at javax.swing.DefaultSingleSelectionModel.setSelectedIndex(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndexImpl(Unknown Source)
at javax.swing.JTabbedPane.setSelectedIndex(Unknown Source)
at javax.swing.plaf.basic.BasicTabbedPaneUI$Handler.mousePressed(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


This happened once - it doesn't happen every time.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Null Pointer on Anneal Layout
Reply #1 - Nov 1st, 2007 at 1:45pm
Print Post  
Hi,

From looking at the code, I think this might happen if you run the layout method while the user is still drawing an arrow. Is that possible in your application, e.g. by using a keyboard shortcut?

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Null Pointer on Anneal Layout
Reply #2 - Nov 1st, 2007 at 2:07pm
Print Post  
Do you mean when user edits the diagram?
That's impossible, since I have this setting:
    setBehavior(BehaviorType.DoNothing);
Nothing can be done by the user.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Null Pointer on Anneal Layout
Reply #3 - Nov 1st, 2007 at 2:21pm
Print Post  
I think the exception will happen if an arrow's origin or destination is null. Are you using arrows that are connected at only one of their ends? For disconnected arrows, you should set their origin and/or destination to an instance of the DummyNode class, and not just skip setting them.

Stoyan
  
Back to top
 
IP Logged
 
ymoran00
Full Member
***
Offline



Posts: 163
Joined: May 2nd, 2007
Re: Null Pointer on Anneal Layout
Reply #4 - Nov 8th, 2007 at 12:06pm
Print Post  
If I create Null items for the arrows - it's by mistake. I added a few tests in the code to look for null values if I made them by mistake.

Thanks!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint