Project

General

Profile

Actions

Bug #5694

closed

Dragging from a port results in a NPE

Added by Christopher Brooks over 11 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Immediate
Assignee:
Category:
interface
Target version:
Start date:
08/23/2012
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5694

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 run

is 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.
Derik

On Aug 20, 2012, at 6:14 PM, Christopher
Brooks<> 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

ErrorDraggingFromAPort.png (70.4 KB) ErrorDraggingFromAPort.png Christopher Brooks, 08/23/2012 02:45 PM
Actions #1

Updated by Christopher Brooks over 11 years ago

We can't seem to replicate this bug locally right now.

Edward checked in a fix that might help with the NPE.

I'm going to reassign this to Derik so that he can try to replicate it.

If the bug is replicatable, please include really detailed instructions
about how to replicate it and a screen shot.

Actions #2

Updated by Derik Barseghian over 11 years ago

I think Dan's comment was referring to a change he made at r30498. After that change I haven't been able to replicate either.

I didn't test extensively. Leaving open for a little more testing...

Actions #3

Updated by Daniel Crawl over 11 years ago

Christopher, to reproduce this revert r30498 and connect two ports.

The problem is caused by the updates in r64430 to how change requests are processed, not the updates to diva. Either the change listener in NamedObjId is doing something wrong, e.g., issuing more change requests in changeExecuted(), or the updates in r64430 introduce a bug that NamedObjId triggers.

Actions #4

Updated by Derik Barseghian over 11 years ago

There's a new issue on trunk related to NamedObjId: if I drag out a String Constant and configure it with a new value, I get a ClassCastException.

[run] Exception occurred during event dispatching:
[run] java.lang.ClassCastException: org.kepler.moml.NamedObjId$1 cannot be cast to org.kepler.moml.NamedObjId
[run] at org.kepler.workflow.WorkflowManager.changeExecuted(WorkflowManager.java:195)
[run] at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:202)
[run] at ptolemy.kernel.util.NamedObj._executeChangeRequests(NamedObj.java:2558)
[run] at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1774)
[run] at ptolemy.actor.CompositeActor.requestChange(CompositeActor.java:1951)
[run] at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1749)
[run] at org.kepler.moml.NamedObjId$1.run(NamedObjId.java:801)
[run] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
[run] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
[run] at java.awt.EventQueue.access$000(EventQueue.java:84)
[run] at java.awt.EventQueue$1.run(EventQueue.java:602)
[run] at java.awt.EventQueue$1.run(EventQueue.java:600)
[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:611)
[run] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
[run] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
[run] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:178)
[run] at java.awt.Dialog$1.run(Dialog.java:1046)
[run] at java.awt.Dialog$3.run(Dialog.java:1098)
[run] at java.security.AccessController.doPrivileged(Native Method)
[run] at java.awt.Dialog.show(Dialog.java:1096)
[run] at java.awt.Component.show(Component.java:1584)
[run] at java.awt.Component.setVisible(Component.java:1536)
[run] at java.awt.Window.setVisible(Window.java:842)
[run] at java.awt.Dialog.setVisible(Dialog.java:986)
[run] at ptolemy.gui.ComponentDialog.&lt;init&gt;(ComponentDialog.java:209)
[run] at ptolemy.gui.ComponentDialog.&lt;init&gt;(ComponentDialog.java:122)
[run] at ptolemy.gui.ComponentDialog.&lt;init&gt;(ComponentDialog.java:101)
[run] at ptolemy.actor.gui.EditParametersDialog.&lt;init&gt;(EditParametersDialog.java:105)
[run] at ptolemy.actor.gui.EditParametersDialog.&lt;init&gt;(EditParametersDialog.java:93)
[run] at ptolemy.vergil.toolbox.ConfigureAction._openDialog(ConfigureAction.java:146)
[run] at ptolemy.vergil.toolbox.ConfigureAction.actionPerformed(ConfigureAction.java:99)
[run] at diva.canvas.interactor.ActionInteractor.mousePressed(ActionInteractor.java:74)
[run] at diva.canvas.interactor.CompositeInteractor.mousePressed(CompositeInteractor.java:199)
[run] at diva.canvas.interactor.SelectionInteractor.mousePressed(SelectionInteractor.java:202)
[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:6053)
[run] at java.awt.Container.processEvent(Container.java:2041)
[run] at java.awt.Component.dispatchEventImpl(Component.java:4651)
[run] at java.awt.Container.dispatchEventImpl(Container.java:2099)
[run] at java.awt.Component.dispatchEvent(Component.java:4481)
[run] at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
[run] at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4235)
[run] at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
[run] at java.awt.Container.dispatchEventImpl(Container.java:2085)
[run] at java.awt.Window.dispatchEventImpl(Window.java:2478)
[run] at java.awt.Component.dispatchEvent(Component.java:4481)
[run] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:643)
[run] at java.awt.EventQueue.access$000(EventQueue.java:84)
[run] at java.awt.EventQueue$1.run(EventQueue.java:602)
[run] at java.awt.EventQueue$1.run(EventQueue.java:600)
[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:616)
[run] at java.awt.EventQueue$2.run(EventQueue.java:614)
[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:613)
[run] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
[run] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
[run] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
[run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
[run] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
[run] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Actions #5

Updated by Derik Barseghian over 11 years ago

Fixed this particular issue in reporting's WorkflowManager at r30536.

(In reply to comment #4)

There's a new issue on trunk related to NamedObjId: if I drag out a String
Constant and configure it with a new value, I get a ClassCastException.

[run] Exception occurred during event dispatching:
[run] java.lang.ClassCastException: org.kepler.moml.NamedObjId$1 cannot
be cast to org.kepler.moml.NamedObjId
[run] at
org.kepler.workflow.WorkflowManager.changeExecuted(WorkflowManager.java:195)

Actions #6

Updated by Derik Barseghian over 11 years ago

I fixed the issue in comment4.
I think Dan knows better the details on the original issue, which I think is no longer an issue. Assigning to him to close/leave open as he sees fit.

Actions #7

Updated by Redmine Admin about 11 years ago

Original Bugzilla ID was 5694

Actions

Also available in: Atom PDF