Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Notification
Commits
1e68c930
Commit
1e68c930
authored
Oct 05, 2021
by
Sanjeev-SLB
Browse files
Broken pipe IOException handler
parent
a7d0430d
Pipeline
#70112
failed with stages
in 36 minutes and 9 seconds
Changes
1
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
notification-core/src/main/java/org/opengroup/osdu/notification/errors/SpringExceptionMapper.java
View file @
1e68c930
...
...
@@ -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
<
Object
>
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
<
Object
>
getErrorResponse
(
AppException
e
)
{
if
(
e
.
getOriginalException
()!=
null
)
{
this
.
log
.
error
(
e
.
getOriginalException
().
getMessage
(),
e
.
getOriginalException
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment