Reading wfs with boolean value 1 always return false
----------------------------------------------------
Key: GEOT-2506
URL: http://jira.codehaus.org/browse/GEOT-2506
Project: GeoTools
Issue Type: Bug
Components: core xml
Affects Versions: 2.6-M1
Environment: Linux
Reporter: Lars Aksel Opsahl
When we do a wfs request and the server responds with 1 instead true for
boolean types. This is parsed as false.
According to XML spec http://www.w3.org/TR/xmlschema-2/#boolean
3.2.2.1 Lexical representation
An instance of a datatype that is defined as - boolean- can have the following
legal literals {true, false, 1, 0}.
3.2.2.2 Canonical representation
The canonical representation for boolean is the set of literals {true, false}.
I fixed this by updating org.geotools.xml.xsi.XSISimpleTypes.Boolean class with
code below
/**
* @see schema.Type#getValue(java.lang.Object, org.xml.sax.Attributes)
*/
public Object getValue(Element element, ElementValue[] value,
Attributes attrs, Map hints) {
if ((value.length == 1) && (value[0].getValue() != null)) {
java.lang.String vb = (java.lang.String) value[0].getValue();
java.lang.Boolean i;
if (vb.equals("1")) {
i = java.lang.Boolean.TRUE;
} else {
i = new java.lang.Boolean((java.lang.String) value[0]
.getValue());
}
return i;
}
return null;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel