Bug #5694
closedDragging from a port results in a NPE
0%
Description
Dan wrote:
--start--
The problem is related to the change listener in
org.kepler.moml.NamedObjId. When the workflow is changed, this
listener fires off additional change requests in changeExecuted().
When I comment out the additional change requests, I don't get
errors or weird behavior with the grab handle. Also, if the
requests are made in the Swing thread, everything works. It's
not clear to me if this actually fixes the problem or why it's
necessary after r64430...Hopefully this helps you track down
the problem.
--end--
On 8/21/12 4:24 PM, Christopher Brooks wrote:
The problem seems to be fairly complex.
There are two changes, r64418 to diva BasicGraphHandle where we check
for null
and r64430 where there are a bunch of changes to ptolemy outside of diva.I agree that the change to BasicGraphHandle would seem to be a good idea.
However, if it is present and r64430 is present, then the blue grab
handles don't
work well in Kepler and Ptolemy. When I drag a connection around it
does not
have a blue grab handle at the end. A blue grab handle appears at the
upper left.
I do get NPEs, but the behavior seems to be better.Another issue is that I believe that Kepler uses diva.jar, so the change to
BasicGraphHandle was not present until I updated diva.jar.I'm not sure about a fix to this, the bug is fairly mysterious. I can take
a look, but it may take a day or two._Christopher
Edward writes:
Rolling back this change will cause more null pointer exceptions.
If the "return" below is not executed, you will get a NPE.if (_site.getFigure() null || _site.getFigure().getParent() null) {
// Cannot relocate.
return;
}Edward
On 8/21/12 12:42 AM, Christopher Brooks wrote:
Hi Derik,
I think this change:
2012-08-18 17:08 eal
- [r64430] /trunk/ptolemy/actor/Manager.java,
/trunk/ptolemy/actor/lib/hoc/LifeCycleManager.java,
/trunk/ptolemy/kernel/undo/RedoChangeRequest.java,
/trunk/ptolemy/kernel/undo/UndoChangeRequest.java,
/trunk/ptolemy/kernel/util/Changeable.java,
/trunk/ptolemy/kernel/util/NamedObj.java,
/trunk/ptolemy/moml/MoMLParser.java: Fixed long standing deadlock
that occurs while editing models while they runis what is causing the stack trace like [1] below.
I'll take a further look tomorrow.
This change is fairly important in that it solves a long standing
issue, so we need
to fix the bug as opposed to just reverting._Christopher
On 8/20/12 6:44 PM, Derik Barseghian wrote:
Hey Christopher,
I updated my local copy of kepler to use ptII r64449 but I'm still
getting errors like [1] below, wild dragging behavior, and remaining
dots.
I haven't seen any rogue floating upper-left endpoints yet though.
DerikOn Aug 20, 2012, at 6:14 PM, Christopher
Brooks<cxh@eecs.berkeley.edu> wrote:Hi Derik,
It seems like it is Edward's change:
2012-08-18 06:22 eal
- [r64418] /trunk/diva/canvas/interactor/BasicGrabHandle.java:
Prevent null pointer exception that can happen while editing a
model while it is running by checking the Figure of Site for the
connector being dragged.The change is:
[dhcp-39-161:~/ptII] cxh% svn diff -r64417:64418
diva/canvas/interactor/BasicGrabHandle.java
Index: diva/canvas/interactor/BasicGrabHandle.java ===================================================================
--- diva/canvas/interactor/BasicGrabHandle.java (revision 64417)
++ diva/canvas/interactor/BasicGrabHandle.java (revision 64418)@ -87,6 +87,10
@
// Be sure to take into account that the transformContext
of the
// site and the context of the grab handle may be different.
TransformContext tc = getTransformContext();
if (_site.getFigure() null ||
_site.getFigure().getParent() null) {
+ // Cannot relocate.
+ return;
+ }
Point2D p = _site.getPoint(tc);
double x = p.getX();
double y = p.getY();I rolled back r64418 and updated diva.jar
_Christopher
On 8/20/12 3:28 PM, Derik Barseghian wrote:
Hey Christopher,
Dan and I are getting an error1 when trying to drag a relation
from a port today in Kepler.
I'm also seeing a few other issues that seem to happen after the
above. I got an NPE2 from a click, have strange actor-drag
behavior (actor drags wildly / shoots off in one direction), and
sometimes dots are left over on canvas at the point where I clicked
on the port. Also when I'm dragging out a relation I also notice in
the upper left corner of canvas a blue 'port endpoint' square
(generally only noticeable in the overview section in the lower left).
See attached screenshot to see dots and blue square.
Derik[1]
java.lang.NullPointerException
at
diva.canvas.TransformContext.getTransform(TransformContext.java:161)
at diva.canvas.AbstractSite.getPoint(AbstractSite.java:82)
at
diva.canvas.connector.BasicManhattanRouter.routeManhattan(BasicManhattanRouter.java:87)at
diva.canvas.connector.BasicManhattanRouter.route(BasicManhattanRouter.java:68)at
diva.canvas.connector.ManhattanConnector.route(ManhattanConnector.java:121)at
ptolemy.vergil.actor.KielerLayoutConnector.route(KielerLayoutConnector.java:214)at
diva.canvas.connector.AbstractConnector.reroute(AbstractConnector.java:285)at
diva.canvas.connector.AbstractConnector.tailMoved(AbstractConnector.java:406)at
diva.canvas.connector.AbstractConnector.setTailSite(AbstractConnector.java:398)at
ptolemy.vergil.actor.ActorEditorGraphController$LinkCreator.mousePressed(ActorEditorGraphController.java:676)at
diva.canvas.interactor.CompositeInteractor.mousePressed(CompositeInteractor.java:199)at diva.canvas.FigureLayer.dispatchEventUpTree(FigureLayer.java:551)
at diva.canvas.FigureLayer.grabPointer(FigureLayer.java:319)
at diva.canvas.FigureLayer.processLayerEvent(FigureLayer.java:673)
at diva.canvas.FigureLayer.dispatchEvent(FigureLayer.java:203)
at diva.canvas.CanvasPane.processLayerEvent(CanvasPane.java:280)
at diva.canvas.CanvasPane.dispatchEvent(CanvasPane.java:89)
at diva.canvas.JCanvas.internalProcessMouseEvent(JCanvas.java:520)
at diva.canvas.JCanvas.processMouseEvent(JCanvas.java:474)
at java.awt.Component.processEvent(Component.java:6140)
at java.awt.Container.processEvent(Container.java:2083)
at java.awt.Component.dispatchEventImpl(Component.java:4737)
at java.awt.Container.dispatchEventImpl(Container.java:2141)
at java.awt.Component.dispatchEvent(Component.java:4565)
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4277)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
at java.awt.Container.dispatchEventImpl(Container.java:2127)
at java.awt.Window.dispatchEventImpl(Window.java:2482)
at java.awt.Component.dispatchEvent(Component.java:4565)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:684)
at java.awt.EventQueue.access$000(EventQueue.java:85)
at java.awt.EventQueue$1.run(EventQueue.java:643)
at java.awt.EventQueue$1.run(EventQueue.java:641)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)at java.awt.EventQueue$2.run(EventQueue.java:657)
at java.awt.EventQueue$2.run(EventQueue.java:655)
at java.security.AccessController.doPrivileged(Native Method)
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)at java.awt.EventQueue.dispatchEvent(EventQueue.java:654)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)[2]
[run] Exception in thread "AWT-EventQueue-0"
java.lang.NullPointerException
[run]
at
diva.canvas.TransformContext.getTransform(TransformContext.java:161)
[run]
at diva.canvas.AbstractSite.getPoint(AbstractSite.java:82)
[run]
at
diva.canvas.interactor.BasicGrabHandle.relocate(BasicGrabHandle.java:94)[run]
at
diva.canvas.interactor.Manipulator.relocateGrabHandles(Manipulator.java:191)[run]
at
diva.canvas.interactor.Manipulator.repaint(Manipulator.java:211)
[run]
at
diva.canvas.interactor.Manipulator.repaint(Manipulator.java:175)
[run]
at
diva.canvas.AbstractFigure.repaint(AbstractFigure.java:236)
[run]
at
diva.canvas.AbstractFigure.repaint(AbstractFigure.java:224)
[run]
at
diva.canvas.FigureDecorator.setChild(FigureDecorator.java:190)
[run]
at
diva.canvas.connector.ConnectorManipulator.setChild(ConnectorManipulator.java:215)[run]
at diva.canvas.FigureLayer.decorate(FigureLayer.java:180)
[run]
at
diva.canvas.interactor.BasicSelectionRenderer.renderSelected(BasicSelectionRenderer.java:119)[run]
at
diva.canvas.interactor.BasicSelectionModel.renderSelected(BasicSelectionModel.java:271)[run]
at
diva.canvas.interactor.BasicSelectionModel.addSelection(BasicSelectionModel.java:101)[run]
at
diva.canvas.interactor.SelectionInteractor.mousePressed(SelectionInteractor.java:172)[run]
at
diva.canvas.FigureLayer.dispatchEventUpTree(FigureLayer.java:551)
[run]
at diva.canvas.FigureLayer.grabPointer(FigureLayer.java:319)
[run]
at
diva.canvas.FigureLayer.processLayerEvent(FigureLayer.java:673)
[run]
at
diva.canvas.FigureLayer.dispatchEvent(FigureLayer.java:203)
[run]
at
diva.canvas.CanvasPane.processLayerEvent(CanvasPane.java:280)
[run]
at diva.canvas.CanvasPane.dispatchEvent(CanvasPane.java:89)
[run]
at
diva.canvas.JCanvas.internalProcessMouseEvent(JCanvas.java:520)
[run]
at diva.canvas.JCanvas.processMouseEvent(JCanvas.java:474)
[run]
at java.awt.Component.processEvent(Component.java:6140)
[run]
at java.awt.Container.processEvent(Container.java:2083)
[run]
at java.awt.Component.dispatchEventImpl(Component.java:4737)
[run]
at java.awt.Container.dispatchEventImpl(Container.java:2141)
[run]
at java.awt.Component.dispatchEvent(Component.java:4565)
[run]
at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4619)
[run]
at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:4277)
[run]
at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:4210)
[run]
at java.awt.Container.dispatchEventImpl(Container.java:2127)
[run]
at java.awt.Window.dispatchEventImpl(Window.java:2482)
[run]
at java.awt.Component.dispatchEvent(Component.java:4565)
[run]
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:684)
[run]
at java.awt.EventQueue.access$000(EventQueue.java:85)
[run]
at java.awt.EventQueue$1.run(EventQueue.java:643)
[run]
at java.awt.EventQueue$1.run(EventQueue.java:641)
[run]
at java.security.AccessController.doPrivileged(Native Method)
[run]
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)[run]
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)[run]
at java.awt.EventQueue$2.run(EventQueue.java:657)
[run]
at java.awt.EventQueue$2.run(EventQueue.java:655)
[run]
at java.security.AccessController.doPrivileged(Native Method)
[run]
at
java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)[run]
at java.awt.EventQueue.dispatchEvent(EventQueue.java:654)
[run]
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)[run]
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)[run]
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)[run]
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
[run]
at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
[run]
at
java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Files