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
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?
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.