X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=pmproducer%2Fsrc%2Fmain%2Fjava%2Forg%2Foran%2Fpmproducer%2Fcontrollers%2FErrorResponse.java;h=7c9bd2ee8484bef6f6d77894e2051c70d6dd97be;hb=refs%2Fchanges%2F95%2F11795%2F4;hp=8411181c5e57174291b2504c7926380ddd03e5fb;hpb=41a1c82b8b1b30644c85b90487f013ccc8ff7f92;p=nonrtric%2Fplt%2Franpm.git diff --git a/pmproducer/src/main/java/org/oran/pmproducer/controllers/ErrorResponse.java b/pmproducer/src/main/java/org/oran/pmproducer/controllers/ErrorResponse.java index 8411181..7c9bd2e 100644 --- a/pmproducer/src/main/java/org/oran/pmproducer/controllers/ErrorResponse.java +++ b/pmproducer/src/main/java/org/oran/pmproducer/controllers/ErrorResponse.java @@ -108,11 +108,8 @@ public class ErrorResponse { public static ResponseEntity create(Throwable e, HttpStatus code) { if (e instanceof RuntimeException) { code = HttpStatus.INTERNAL_SERVER_ERROR; - } else if (e instanceof ServiceException) { - ServiceException se = (ServiceException) e; - if (se.getHttpStatus() != null) { - code = se.getHttpStatus(); - } + } else if (e instanceof ServiceException se && se.getHttpStatus() != null) { + code = se.getHttpStatus(); } return create(e.toString(), code); }