From 603172c88363a00fe1c961a8219407450f941f25 Mon Sep 17 00:00:00 2001 From: Stephan Reichhelm Date: Fri, 23 Sep 2022 09:59:19 +0200 Subject: [PATCH] prevent exceptions with "null" message --- .../org/deegree/services/csw/CswExceptionReportSerializer.java | 2 +- .../services/wcs/WCS100ServiceExceptionReportSerializer.java | 2 +- .../wms/controller/WMS111ExceptionReportSerializer.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/deegree-services/deegree-services-csw/src/main/java/org/deegree/services/csw/CswExceptionReportSerializer.java b/deegree-services/deegree-services-csw/src/main/java/org/deegree/services/csw/CswExceptionReportSerializer.java index 481b493225..bab94eb20e 100644 --- a/deegree-services/deegree-services-csw/src/main/java/org/deegree/services/csw/CswExceptionReportSerializer.java +++ b/deegree-services/deegree-services-csw/src/main/java/org/deegree/services/csw/CswExceptionReportSerializer.java @@ -101,7 +101,7 @@ public void serializeExceptionToXML( XMLStreamWriter writer, OWSException ex ) writer.writeAttribute( "locator", ex.getLocator() ); } writer.writeStartElement( OWS_NS, "ExceptionText" ); - writer.writeCharacters( ex.getMessage() ); + writer.writeCharacters( ex.getMessage() != null ? ex.getMessage() : "not available" ); writer.writeEndElement(); writer.writeEndElement(); // Exception writer.writeEndElement(); // ExceptionReport diff --git a/deegree-services/deegree-services-wcs/src/main/java/org/deegree/services/wcs/WCS100ServiceExceptionReportSerializer.java b/deegree-services/deegree-services-wcs/src/main/java/org/deegree/services/wcs/WCS100ServiceExceptionReportSerializer.java index d28d3769e5..3021157e50 100644 --- a/deegree-services/deegree-services-wcs/src/main/java/org/deegree/services/wcs/WCS100ServiceExceptionReportSerializer.java +++ b/deegree-services/deegree-services-wcs/src/main/java/org/deegree/services/wcs/WCS100ServiceExceptionReportSerializer.java @@ -73,7 +73,7 @@ public void serializeExceptionToXML( XMLStreamWriter writer, OWSException ex ) if ( ex.getLocator().length() > 0 ) { writer.writeAttribute( "locator", ex.getLocator() ); } - writer.writeCharacters( ex.getMessage() ); + writer.writeCharacters( ex.getMessage() != null ? ex.getMessage() : "not available" ); writer.writeEndElement(); // ServiceException writer.writeEndElement(); // ServiceExceptionReport } diff --git a/deegree-services/deegree-services-wms/src/main/java/org/deegree/services/wms/controller/WMS111ExceptionReportSerializer.java b/deegree-services/deegree-services-wms/src/main/java/org/deegree/services/wms/controller/WMS111ExceptionReportSerializer.java index a8b22964e9..2c5ff3e605 100644 --- a/deegree-services/deegree-services-wms/src/main/java/org/deegree/services/wms/controller/WMS111ExceptionReportSerializer.java +++ b/deegree-services/deegree-services-wms/src/main/java/org/deegree/services/wms/controller/WMS111ExceptionReportSerializer.java @@ -63,7 +63,7 @@ public void serializeExceptionToXML( XMLStreamWriter writer, OWSException ex ) if ( ex.getLocator() != null && !"".equals( ex.getLocator().trim() ) ) { writer.writeAttribute( "locator", ex.getLocator() ); } - writer.writeCharacters( ex.getMessage() ); + writer.writeCharacters( ex.getMessage() != null ? ex.getMessage() : "not available" ); writer.writeEndElement(); // ServiceException writer.writeEndElement(); // ServiceExceptionReport }