Bug 71392 - NullPointerException in DragEditPartsTracker when dragging a connector and its label
Summary: NullPointerException in DragEditPartsTracker when dragging a connector and it...
Status: RESOLVED DUPLICATE of bug 106114
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2.0 (Callisto) RC3   Edit
Assignee: Steven R. Shaw CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-04 12:50 EDT by Maged Elaasar CLA
Modified: 2006-05-15 16:48 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Maged Elaasar CLA 2004-08-04 12:50:28 EDT
1- select a connector and its label (a child of the connector)
2- Click on the label to drag the group
3- NullPointerException in DragEditPartsTracker
DragEditPartsTrackerEx(DragEditPartsTracker).updateTargetRequest() line: 577

The basic problem is that in the method captureSourceDimensions() the 
operatorSet was empty because the logic there excludes all the dependent 
editparts (the label) which leaves the connector which does not understand the 
request.

Having an empty operation set will cause the code that initializes 
the 'compoundSrcRect' field to not be invoked in the same method. Then latter 
in the updateTargetRequest, there is no assumption that the variable can be 
null and you get the exception.
Comment 1 Randy Hudson CLA 2004-08-04 13:06:45 EDT
What do you want to happen?  Do you think the label should be draggable in this 
case, or do you just want a NOT sign without the NPE?
Comment 2 Chris Lee CLA 2005-11-04 21:08:11 EST
The same error happens when there is an extension of NonResizableEditPolicy 
installed on a part where isDragAllowed is set to false.  When attempting to 
drag said part, DragEditPartsTracker.captureSourceDimensions creates an 
operation set which ends up being empty since the part doesn't understand the 
request.  As a result, compoundSrcRect and sourceRectangle are both null when 
it leaves the loop.  

I noted there was a TODO under this loop for Pratik to check if the operation
 set ever does not include the source edit part, and there is code to make 
sure the sourceRectangle is not null (this is a case where it is).  However, 
compoundSrcRect may still be null, and that is not taken care of...

What should happen is that perhaps DragEditPartsTracker.handleDragInProgress 
could check if the operation set is empty, and if so, do nothing?

The result should be that if the operation set ends up empty, a NOT sign 
without the NPE would be the best result.
Comment 3 Chris Lee CLA 2005-11-04 21:19:23 EST
As a side note, a workaround (for some cases) until this bug is fixed is to 
just override getDragTracker for problematic edit parts:

    public DragTracker getDragTracker (Request req)
    {
        return new SelectEditPartTracker(this);
    }

Note - this "workaround" is overly simplified, but the basic idea should work -
 if a part is not supposed to be dragged, return a different tracker when 
asked.
Comment 4 Pratik Shah CLA 2005-11-07 12:13:01 EST
The problem mentioned in comment 2 was fixed in 3.1.1.  See bug 106114.
Comment 5 Steven R. Shaw CLA 2006-05-05 11:06:22 EDT
The fix for bug 106114 should be propogated to 3.2
Comment 6 Steven R. Shaw CLA 2006-05-15 16:48:48 EDT
The fix for 106114 is already in the 3.2 stream.  Resolving as duplicate...

*** This bug has been marked as a duplicate of 106114 ***