eclipse-sirius / sirius-desktop

Sirius Desktop: desktop-based graphical modelers for dedicated DSLs
https://eclipse.dev/sirius/
Eclipse Public License 2.0
15 stars 12 forks source link

IndexOutOfBoundsException on circular edge #517

Open peransin-obeo opened 14 hours ago

peransin-obeo commented 14 hours ago

Versions: Sirius 7.4.4 org.eclipse.gef 3.16.0 draw2d 3.14.100

When reconnecting an edge from a Border node to it container node, a exception is raised:

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
    at org.eclipse.draw2d.geometry.PointList.getPoint(PointList.java:184)
    at org.eclipse.draw2d.geometry.PointList.getFirstPoint(PointList.java:146)
    at org.eclipse.sirius.diagram.ui.graphical.figures.CanonicalRectilinearRouter.resetEndPointsToEdge(CanonicalRectilinearRouter.java:176)
    at org.eclipse.sirius.diagram.ui.graphical.figures.CanonicalRectilinearRouter.routeLine(CanonicalRectilinearRouter.java:141)
    at org.eclipse.sirius.diagram.ui.internal.operation.CenterEdgeEndModelChangeOperation.handleRectilinearCase(CenterEdgeEndModelChangeOperation.java:376)
    at org.eclipse.sirius.diagram.ui.internal.operation.CenterEdgeEndModelChangeOperation.centerEdgeEnds(CenterEdgeEndModelChangeOperation.java:230)
    at org.eclipse.sirius.diagram.ui.internal.operation.CenterEdgeEndModelChangeOperation.execute(CenterEdgeEndModelChangeOperation.java:166)
    at org.eclipse.sirius.diagram.ui.internal.operation.CenterEdgeEndModelChangeOperation.execute(CenterEdgeEndModelChangeOperation.java:1)
    at org.eclipse.sirius.diagram.ui.internal.refresh.listeners.EdgeLayoutUpdaterModelChangeTrigger$EdgeLayoutUpdaterCommand.doExecute(EdgeLayoutUpdaterModelChangeTrigger.java:258)
    at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:130)
    at org.eclipse.emf.common.command.CompoundCommand.execute(CompoundCommand.java:261)
    at org.eclipse.emf.transaction.util.TriggerCommand.execute(TriggerCommand.java:108)
    at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.executeTriggers(WorkspaceCommandStackImpl.java:393)
    at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.precommit(TransactionalEditingDomainImpl.java:707)
    at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:409)
    at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.executeTriggers(WorkspaceCommandStackImpl.java:403)
    at org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl.precommit(TransactionalEditingDomainImpl.java:707)
    at org.eclipse.emf.transaction.impl.TransactionImpl.commit(TransactionImpl.java:409)
    at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
    at org.eclipse.gmf.runtime.common.core.command.CompositeCommand.doExecuteWithResult(CompositeCommand.java:404)
    at org.eclipse.gmf.runtime.common.core.command.AbstractCommand.execute(AbstractCommand.java:135)
    at org.eclipse.sirius.diagram.ui.tools.internal.commands.WrappingCommandIgnoringAffectedFiles.execute(WrappingCommandIgnoringAffectedFiles.java:125)
    at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:496)
    at org.eclipse.sirius.diagram.ui.tools.internal.editor.DDiagramCommandStack.execute(DDiagramCommandStack.java:73)

Issue happens when calling computePointListByIntersections in resetEndPointsToEdge. It is assumes in this method that srcIntersections and tgtIntersections are never empty.

peransin-obeo commented 14 hours ago

Detected in a POC for Huawei.