Bug 323617 - PointListUtilities.calculatePointRelativeToLine returns null with zero-sized connections
Summary: PointListUtilities.calculatePointRelativeToLine returns null with zero-sized ...
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.2.2   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 1.4.1   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-25 10:40 EDT by Romain Raugi CLA
Modified: 2010-09-09 13:23 EDT (History)
4 users (show)

See Also:


Attachments
patch (3.12 KB, patch)
2010-09-02 18:03 EDT, Alex Boyko CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Romain Raugi CLA 2010-08-25 10:40:19 EDT
Build Identifier: M20100211-1343

It is a regression. Given a pointList including only the origin and the extremity which are identical:

* With GMF Runtime 1.2.1, PointListUtilities.calculatePointRelativeToLine returns a point, equals to the origin and the extremity. Expected.

* With GMF Runtime 1.3.0, it returns null. PointListUtilities.getLineSegments(PointList) implementation has changed and does not consider zero-sized segments anymore. An NPE is thrown by LabelHelper.offsetFromRelativeCoordinate (and also NonResizableLabelEditPolicy.showChangeBoundsFeedback) when we are trying to locate a label around a zero-sized connection.


Reproducible: Always

Steps to Reproduce:
Can be reproduced programmatically (nodes at the same place, zero-sized connections and programmatically by moving labels through ChangeBoundsRequests).
Comment 1 Romain Raugi CLA 2010-08-25 10:45:22 EDT
GMF 2.2.1 and 2.2.2, not 1.2.1 and 1.3.0.
Comment 2 Alex Boyko CLA 2010-09-02 18:03:40 EDT
Created attachment 178109 [details]
patch

That looks like a bad fix from me.

Changed PointListUtilities#getLineSegments(PointList) not to create linesegments where origin == terminal. Methods working with a line created going through line segment threw exceptions and felt like a line segment with origin == terminus is not really a line segment and hence cannot be treated as such.
Seems like it's too late for this adjustment. Hence, I'm reverting the fix for PointListUtilities#getLineSegments(PointList) and removing segments where origin == terminus myself where they need to be removed.

Patch attached.

Anthony, can you please review this fix?
Comment 3 Anthony Hunter CLA 2010-09-07 15:20:42 EDT
(In reply to comment #2)
> Created an attachment (id=178109) [details]
> patch
> 
> That looks like a bad fix from me.
> 
> Changed PointListUtilities#getLineSegments(PointList) not to create
> linesegments where origin == terminal. Methods working with a line created
> going through line segment threw exceptions and felt like a line segment with
> origin == terminus is not really a line segment and hence cannot be treated as
> such.
> Seems like it's too late for this adjustment. Hence, I'm reverting the fix for
> PointListUtilities#getLineSegments(PointList) and removing segments where
> origin == terminus myself where they need to be removed.
> 
> Patch attached.
> 
> Anthony, can you please review this fix?

OK, sounds good. The patch is good to commit.
Comment 4 Anthony Hunter CLA 2010-09-09 10:51:53 EDT
Alex, can you commit today (now) so we can run RC3?
Comment 5 Alex Boyko CLA 2010-09-09 13:23:25 EDT
Sorry for the late delivery. Delivered to R1_4_maintenance and HEAD.