Hi David,
Yup, looks like a bug to me. What makes me wonder is how the wfs
datastore functions since i believe it uses this code to make requests.
Although it be preferring GET to make requests. Perhaps Gabriel can commend.
But yeah, looks like a bug, the patch should be simple enough. If you
whip it up and all the test cases pass that would be good enough for me.
-Justin
David R Robison wrote:
> I am trying to serialize a WFS GetFeature request back to XML. I setup
> my code as follows:
>
> Configuration c = new org.geotools.wfs.v1_0.WFSConfiguration();
> Encoder e = new Encoder( c );
> e.setIndenting(true);
> e.encode( object, new QName( c.getXSD().getNamespaceURI(), "GetFeature"
> ), System.out );
>
> However, I get the following error:
>
> Caused by: java.lang.ClassCastException: javax.xml.namespace.QName
> cannot be cast to java.lang.String
> at
> org.geotools.wfs.bindings.QueryTypeBinding.getProperty(QueryTypeBinding.java:192)
> at
> org.geotools.xml.impl.GetPropertyExecutor.visit(GetPropertyExecutor.java:91)
>
> It seems like the problem is in the
> org.geotools.wfs.bindings.QueryTypeBinding getProperty function. The XSD
> defines typeName as a QName but the code looks like it expects it to be
> a String:
>
> public Object getProperty(Object object, QName name) throws Exception {
> if ("typeName".equals(name.getLocalPart())) {
> QueryType query = (QueryType) object;
> List typeName = query.getTypeName();
> StringBuilder typeNameList = new StringBuilder();
> if (typeName != null) {
> for (Iterator<String> it = typeName.iterator();
> it.hasNext();) {
> typeNameList.append(it.next());
> if (it.hasNext()) {
> typeNameList.append(",");
> }
> }
> }
> return typeNameList.toString();
> } else if ("SortBy".equals(name.getLocalPart())) {
> QueryType query = (QueryType) object;
> List sortBy = query.getSortBy();
> if (sortBy != null && sortBy.size() == 0) {
> return null;
> }
> }
>
> return super.getProperty(object, name);
> }
>
> Am I reading this right? Any ideas?
>
> Thanks, David
>
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users