WPS Fails to Parse deegree 3 capabilities
-----------------------------------------
Key: GEOT-3160
URL: http://jira.codehaus.org/browse/GEOT-3160
Project: GeoTools
Issue Type: Bug
Components: core xml
Reporter: Jody Garnett
Assignee: Jody Garnett
Fix For: 2.7-RC1
Second issue turing up in testing ... unable to parse capabilities document.
The code in issue is here:
{code}
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case Wps10Package.DEFAULT_TYPE1__UOM:
setUOM((Unit) newValue);
return;
}
super.eSet(featureID, newValue);
}
{code}
And it is failing as it was unable to cast a String ... to a Unit.
To help matters along I have provided a better error message using a check:
{code}
if (newValue instanceof String) {
throw new ClassCastException("Unable to cast String \"" +
newValue + "\" to a Unit");
}
{code}
Allowing me to get a useful stack trace:
{panel}
java.lang.RuntimeException: Parsing failed for Default:
java.lang.RuntimeException: Unable to set property: UOM for eobject:
{http://www.opengis.net/wps/1.0.0}SupportedUOMsType_Default
...
Caused by: java.lang.ClassCastException: Unable to cast String "unity" to a Unit
at
net.opengis.wps10.impl.DefaultType1Impl.eSet(DefaultType1Impl.java:128)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:654)
at org.geotools.xml.EMFUtils.set(EMFUtils.java:61)
... 40 more
{panel}
After a bit of help from Ben (thanks Ben!) the UnitBinding class was found;
which contains a bunch of fun tricks to convert a String to a Unit.
We are supposed to be able to use:
{noformat}
Object parseObject = UnitFormat.getInstance().parseObject((String) value);
Object parseObject = UnitFormat.getAsciiInstance().parseObject((String)
value);
{noformat}
But in a fit of standardisation the OGC do their own thing rather then use SI
units. The code already contains hacks along the lines of:
{noformat}
if (name.equalsIgnoreCase("feet")) {
return lookup(NonSI.class, "foot");
}
{noformat}
So we will need to sort out a good representation of unity? What is unity...
--
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
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel