From 161e105b07e924ba7775f8a5e84c81e7792be0fc Mon Sep 17 00:00:00 2001 From: Lyn Elisa Goltz Date: Thu, 2 Jun 2016 15:06:13 +0200 Subject: [PATCH] #3517 - throw exception expected from ets-wfs20 update with an invalid geometry is requested --- .../deegree/services/wfs/TransactionHandler.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java index 96d4f5b403..e3d636dcd8 100644 --- a/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java +++ b/deegree-services/deegree-services-wfs/src/main/java/org/deegree/services/wfs/TransactionHandler.java @@ -39,6 +39,7 @@ import static javax.xml.stream.XMLStreamConstants.END_ELEMENT; import static javax.xml.stream.XMLStreamConstants.START_ELEMENT; import static org.deegree.commons.ows.exception.OWSException.INVALID_PARAMETER_VALUE; +import static org.deegree.commons.ows.exception.OWSException.INVALID_VALUE; import static org.deegree.commons.ows.exception.OWSException.MISSING_PARAMETER_VALUE; import static org.deegree.commons.ows.exception.OWSException.NO_APPLICABLE_CODE; import static org.deegree.commons.ows.exception.OWSException.OPERATION_NOT_SUPPORTED; @@ -424,8 +425,10 @@ private void doInsert( Insert insert ) private FeatureCollection parseFeaturesOrCollection( XMLStreamReader xmlStream, GMLVersion inputFormat, ICRS defaultCRS ) - throws XMLStreamException, XMLParsingException, UnknownCRSException, - ReferenceResolvingException { + throws XMLStreamException, + XMLParsingException, + UnknownCRSException, + ReferenceResolvingException { FeatureCollection fc = null; @@ -605,7 +608,8 @@ private List getReplacementProps( Update update, Feat PropertyType pt = ft.getPropertyDeclaration( propName ); if ( pt == null ) { throw new OWSException( "Cannot update property '" + propName + "' of feature type '" + ft.getName() - + "'. The feature type does not define this property.", OPERATION_NOT_SUPPORTED ); + + "'. The feature type does not define this property.", + OPERATION_NOT_SUPPORTED ); } XMLStreamReader xmlStream = replacement.getReplacementValue(); int index = simpleMultiProp == null ? 0 : simpleMultiProp.second; @@ -622,7 +626,8 @@ private List getReplacementProps( Update update, Feat GMLFeatureReader featureReader = gmlReader.getFeatureReader(); ICRS crs = master.getDefaultQueryCrs(); - Property prop = featureReader.parseProperty( new XMLStreamReaderWrapper( xmlStream, null ), pt, crs ); + Property prop = featureReader.parseProperty( new XMLStreamReaderWrapper( xmlStream, null ), pt, + crs ); // TODO make this hack unnecessary TypedObjectNode propValue = prop.getValue(); @@ -641,6 +646,9 @@ private List getReplacementProps( Update update, Feat xmlStream.require( END_ELEMENT, null, "Property" ); // contract: skip to next ELEMENT_EVENT xmlStream.nextTag(); + } catch ( XMLParsingException e ) { + LOG.debug( e.getMessage(), e ); + throw new OWSException( e.getMessage(), INVALID_VALUE ); } catch ( Exception e ) { LOG.debug( e.getMessage(), e ); throw new OWSException( e.getMessage(), NO_APPLICABLE_CODE );