diff --git a/NOTICE b/NOTICE index 007ccfa2d7466afe953926121c665f69f8288ee7..4b3013b06de943b0830e69682d6eed800380ed7a 100644 --- a/NOTICE +++ b/NOTICE @@ -595,7 +595,7 @@ The following software have components provided under the terms of this license: - Java Servlet API (from https://projects.eclipse.org/projects/ee4j.servlet) - Java(TM) API for WebSocket (from https://repo1.maven.org/maven2/org/jboss/spec/javax/websocket/jboss-websocket-api_1.1_spec) - Old JAXB Core (from https://eclipse-ee4j.github.io/jaxb-ri/) -- Project Lombok (from http://projectlombok.org) +- Project Lombok (from https://projectlombok.org) ======================================================================== ImageMagick @@ -691,7 +691,7 @@ The following software have components provided under the terms of this license: - Netty/Codec/HTTP (from https://repo1.maven.org/maven2/io/netty/netty-codec-http) - Netty/Common (from https://repo1.maven.org/maven2/io/netty/netty-common) - Netty/Common (from https://repo1.maven.org/maven2/io/netty/netty-common) -- Project Lombok (from http://projectlombok.org) +- Project Lombok (from https://projectlombok.org) - SLF4J API Module (from http://www.slf4j.org) - Spongy Castle (from http://rtyley.github.io/spongycastle/) - Spring Data for Azure Cosmos DB SQL API (from https://github.com/Azure/azure-sdk-for-java/tree/master/sdk/cosmos/azure-spring-data-cosmos) @@ -784,7 +784,7 @@ The following software have components provided under the terms of this license: - Microsoft Azure SDK for EventGrid Management (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java) - Microsoft Azure client library for Blob Storage (from https://github.com/Azure/azure-sdk-for-java) -- Project Lombok (from http://projectlombok.org) +- Project Lombok (from https://projectlombok.org) - Spring Web (from https://github.com/spring-projects/spring-framework) - azure-documentdb (from https://azure.microsoft.com/en-us/services/cosmos-db/) - msal4j (from https://github.com/AzureAD/microsoft-authentication-library-for-java) @@ -806,3 +806,5 @@ The following software have components provided under the terms of this license: - JUnit Platform Commons (from https://junit.org/junit5/) - JUnit Platform Engine API (from https://junit.org/junit5/) - Spongy Castle (from http://rtyley.github.io/spongycastle/) + + diff --git a/notification-core/src/main/java/org/opengroup/osdu/notification/errors/SpringExceptionMapper.java b/notification-core/src/main/java/org/opengroup/osdu/notification/errors/SpringExceptionMapper.java index a22bc99585a4d8026bd99669f3f18024accc9553..81b31a786d63a2411990ba00f950796ab3a521a1 100644 --- a/notification-core/src/main/java/org/opengroup/osdu/notification/errors/SpringExceptionMapper.java +++ b/notification-core/src/main/java/org/opengroup/osdu/notification/errors/SpringExceptionMapper.java @@ -18,6 +18,8 @@ package org.opengroup.osdu.notification.errors; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.Ordered; @@ -32,6 +34,7 @@ import org.springframework.web.context.request.WebRequest; import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler; import org.opengroup.osdu.core.common.model.http.AppException; import javax.validation.ValidationException; +import java.io.IOException; import java.nio.file.AccessDeniedException; import java.util.List; import java.util.stream.Collectors; @@ -78,6 +81,17 @@ public class SpringExceptionMapper extends ResponseEntityExceptionHandler { "An unknown error has occurred.", e)); } + @ExceptionHandler(IOException.class) + public ResponseEntity handleIOException(IOException e) { + if (StringUtils.containsIgnoreCase(ExceptionUtils.getRootCauseMessage(e), "Broken pipe")) { + this.log.warning("Client closed the connection while request still being processed"); + return null; + } else { + return this.getErrorResponse( + new AppException(HttpStatus.SERVICE_UNAVAILABLE.value(), "Unknown error", e.getMessage(), e)); + } + } + private ResponseEntity getErrorResponse(AppException e) { if(e.getOriginalException()!= null) { this.log.error(e.getOriginalException().getMessage(), e.getOriginalException());