Hi all, I am writing a client application using the WFS-Plugin to send WFS-T requests.
The features I am sending have multiple geometry attributes, some might be null. On null geometries the GML encoding fails with the following stacktrace: Exception in thread "main" java.lang.NullPointerException at org.geotools.xml.gml.GMLComplexTypes$MultiPolygonPropertyType.encode(GMLComplexTypes.java:6283) at org.geotools.xml.gml.GMLComplexTypes$AbstractFeatureType.print(GMLComplexTypes.java:4409) at org.geotools.xml.gml.GMLComplexTypes$AbstractFeatureType.encode(GMLComplexTypes.java:4387) at org.geotools.data.wfs.v1_0_0.xml.WFSTransactionComplexTypes$InsertElementType.encode(WFSTransactionComplexTypes.java:951) at org.geotools.data.wfs.v1_0_0.xml.WFSTransactionComplexTypes$TransactionType.encode(WFSTransactionComplexTypes.java:318) at org.geotools.xml.DocumentWriter.writeFragment(DocumentWriter.java:318) at org.geotools.xml.DocumentWriter.writeDocument(DocumentWriter.java:216) at org.geotools.data.wfs.v1_0_0.WFSTransactionState.commitPost(WFSTransactionState.java:296) at org.geotools.data.wfs.v1_0_0.WFSTransactionState.commit(WFSTransactionState.java:160) at org.geotools.data.DefaultTransaction.commit(DefaultTransaction.java:186) ... >From org.geotools.xml.gml.GMLComplexTypes$MultiPolygonPropertyType: public void encode(Element element, Object value, PrintHandler output, Map hints) throws IOException, OperationNotSupportedException { if ((value == null) || !(value instanceof MultiPolygon)) { throw new OperationNotSupportedException("Value is "+value == null?"null":value.getClass().getName()); } ... } (Instead of the desired OperationNotSupportedException a NPE is thrown because of operator precedence.) Question: - Why the exception? It would have been quite easy to just skip null values and write nothing instead. - What is the suggested solution? I have tried to encode an empty Multipolygon instead but it fails, too. Best regards any many thanks, Andreas PS: Somebody on FOSS4G noted, that there is a lack of positive feedback from the community regarding GeoServer and GeoTools. For my part: I think both project are great and the amount a features is overwhelming. Many thanks to the developers and the community! Both thumbs up!
------------------------------------------------------------------------------
_______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users