Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed exception code and status code of response when invalid geometry is inserted #703

Merged
merged 1 commit into from
Aug 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -605,7 +608,8 @@ private List<ParsedPropertyReplacement> 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;
Expand All @@ -622,7 +626,8 @@ private List<ParsedPropertyReplacement> 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();
Expand All @@ -641,6 +646,9 @@ private List<ParsedPropertyReplacement> 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 );
Expand Down