| IOOBE while dragging bendpoint [message #560089] |
Tue, 21 September 2010 03:45  |
Andreas Scharf Messages: 18 Registered: September 2010 |
Junior Member |
|
|
Hi,
sometimes I get an IndexOutOfBoundsException while dragging a bendpoint. Here's the stack trace:
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at org.eclipse.draw2d.geometry.PointList.getPoint(PointList.jav a:190)
at org.eclipse.gef.editpolicies.BendpointEditPolicy.setReferenc ePoints(BendpointEditPolicy.java:290)
at org.eclipse.gef.editpolicies.BendpointEditPolicy.showMoveBen dpointFeedback(BendpointEditPolicy.java:342)
at org.eclipse.gef.editpolicies.BendpointEditPolicy.showSourceF eedback(BendpointEditPolicy.java:375)
at org.eclipse.gef.editparts.AbstractEditPart.showSourceFeedbac k(AbstractEditPart.java:974)
at org.eclipse.gef.tools.SimpleDragTracker.showSourceFeedback(S impleDragTracker.java:229)
at org.eclipse.gef.tools.SimpleDragTracker.handleDragInProgress (SimpleDragTracker.java:137)
at org.eclipse.gef.tools.AbstractTool.mouseDrag(AbstractTool.ja va:994)
at org.eclipse.gef.tools.SelectionTool.mouseDrag(SelectionTool. java:511)
at org.eclipse.gef.EditDomain.mouseDrag(EditDomain.java:230)
at org.eclipse.gef.ui.parts.DomainEventDispatcher.dispatchMouse Moved(DomainEventDispatcher.java:357)
at org.eclipse.draw2d.LightweightSystem$EventHandler.mouseMove( LightweightSystem.java:533)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListe ner.java:199)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java :84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.ja va:3880)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java :3473)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.jav a:2405)
...
Any idea?
King regards,
Andreas
|
|
|
|
|
| Re: IOOBE while dragging bendpoint [message #628834 is a reply to message #628793] |
Fri, 24 September 2010 07:22   |
Vijay Raj Messages: 600 Registered: July 2009 |
Senior Member |
|
|
The problem is in
public int getDistance2(Point pt) {
long i = pt.x - x;
long j = pt.y - y;
long result = i * i + j * j;
if (result > Integer.MAX_VALUE)
return Integer.MAX_VALUE;
return (int)result;
}
here if result becomes more then Integer.MAX_VALUE then the distance returned is Integer.MAX_VALUE
once it becomes MAX
points.getPoint(i).getDistance2(bp) < smallestDistance will be always false and bpIndex will reach to end of index of point list(in u r case there are only two point in the point list)
This should be a case of very long connection whose distance between first and last point would be more then int MAX..
hope this helps in reproducing the problem..
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
|
|
| Re: IOOBE while dragging bendpoint [message #629109 is a reply to message #629100] |
Mon, 27 September 2010 05:05   |
Vijay Raj Messages: 600 Registered: July 2009 |
Senior Member |
|
|
First of all does u r scanario include a long connection(long means very long)...
if yes then i think can be reproduced in logic example which has bendpoint connections...
---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay
|
|
|
|
Powered by
FUDForum. Page generated in 0.01734 seconds