The encode of LineStringPropertyType in GMLComplexType verify the class of value like a point

Description

In GMLComplexType, it exist an inner class LineStringPropertyType.
This innerclass contains an method encode like :
public void encode(Element element, Object value, PrintHandler output,
Map hints) throws IOException, OperationNotSupportedException {
if ((value == null) || !(value instanceof Point)) {
throw new OperationNotSupportedException("Value is "+value == null?"null":value.getClass().getName());
}

if (element == null) {
output.startElement(GMLSchema.NAMESPACE, "lineStringProperty",
null);
GMLComplexTypes.encode(null, (LineString) value, output);
output.endElement(GMLSchema.NAMESPACE, "lineStringProperty");
} else {
output.startElement(element.getNamespace(), element.getName(),
null);
GMLComplexTypes.encode(null, (LineString) value, output);
output.endElement(element.getNamespace(), element.getName());
}
}
In the first if, we check the parameter value but class of value is never Point but LineString.
In other inner class for propertyType the check of value in encode is correct.

Environment

CentOS, liferay vaadin, jboss, geoserver

Activity

Andrea Aime 
February 15, 2017 at 11:34 AM

Mass transitioning all resolved issues that have not been updated in the last month to closed state

jadot 
October 28, 2015 at 1:58 PM

jadot 
October 28, 2015 at 10:44 AM

the bug is in the file https://github.com/geotools/geotools/blob/master/modules/library/xml/src/main/java/org/geotools/xml/gml/GMLComplexTypes.java.
The line 5776 is "if ((value == null) || !(value instanceof Point)) {" and for me that must be "if ((value == null) || !(value instanceof LineString)) {"

Brad Hards 
October 28, 2015 at 9:35 AM

This is a bit hard to follow. Can you say exactly which file you are referring to (perhaps a link to the right line(s) using a reference to https://github.com/geotools/geotools)?

Any chance you could produce a test case and patch as a pull request?

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created October 28, 2015 at 7:35 AM
Updated February 15, 2017 at 11:34 AM
Resolved November 7, 2015 at 4:09 PM