From 7c449cf6a2596db7d0cd8a57145b5198be551559 Mon Sep 17 00:00:00 2001 From: Daniel Silverthorn Date: Mon, 26 Mar 2018 13:58:14 -0400 Subject: Catch IllegalArgumentException for error message Also had to upversion event client library Change-Id: I4dbbf8f35630d93cca9e5d8971e7fde8a65b0811 Issue-ID: AAI-945 Signed-off-by: Daniel Silverthorn --- champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'champ-service/src/main/java') diff --git a/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java b/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java index e9a2830..577dbc9 100644 --- a/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java +++ b/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java @@ -205,6 +205,8 @@ public class ChampRESTAPI { response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build(); } catch (ChampServiceException ce) { response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build(); + } catch (IllegalArgumentException e) { + response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build(); } catch (Exception e) { response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); LoggingUtil.logInternalError(logger, e); @@ -243,6 +245,8 @@ public class ChampRESTAPI { response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build(); } catch (ChampServiceException ce) { response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build(); + } catch (IllegalArgumentException e) { + response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build(); } catch (Exception e) { response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); LoggingUtil.logInternalError(logger, e); @@ -387,6 +391,8 @@ public class ChampRESTAPI { response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build(); } catch (ChampServiceException ce) { response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build(); + } catch (IllegalArgumentException e) { + response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build(); } catch (Exception e) { response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); LoggingUtil.logInternalError(logger, e); @@ -423,6 +429,8 @@ public class ChampRESTAPI { response = Response.status(Status.BAD_REQUEST).entity("Unable to parse the payload").build(); } catch (ChampServiceException ce) { response = Response.status(ce.getHttpStatus()).entity(ce.getMessage()).build(); + } catch (IllegalArgumentException e) { + response = Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build(); } catch (Exception e) { response = Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build(); LoggingUtil.logInternalError(logger, e); -- cgit 1.2.3-korg