From 8c193243356e909d0210036006aa9416c6455d00 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Thu, 23 Apr 2020 15:57:53 -0400 Subject: Report, not discard, caught exception in ctor The PortalRestCentralServiceImpl constructor instantiates a class by name then calls methods on the new object. The ctor uses try/catch but if an exception occurs, the ctor discards that exception and throws ClassCastException with a vague message. Change to throw ServletException and include the cause exception. Change-Id: I4f9f0c03026cedff5e65fb904f24eb3f6b658fac Issue-ID: PORTAL-865 Signed-off-by: Lott, Christopher (cl778h) --- .../core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java index 54ce2f4f..21c3f21c 100644 --- a/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java +++ b/ecomp-sdk/epsdk-fw/src/main/java/org/onap/portalsdk/core/onboarding/crossapi/PortalRestAPICentralServiceImpl.java @@ -85,7 +85,7 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService { password = portalRestCentralService.getAppCredentials().get(IPortalRestCentralService.CREDENTIALS_PASS); appName = portalRestCentralService.getAppCredentials().get(IPortalRestCentralService.CREDENTIALS_APP); } catch (Exception e) { - throw new ClassCastException("Failed to find or instantiate class "); + throw new ServletException("Failed to instantiate class " + centralClassName, e); } } @@ -211,4 +211,4 @@ public class PortalRestAPICentralServiceImpl implements IPortalRestAPIService { return credentialsMap; } -} \ No newline at end of file +} -- cgit 1.2.3-korg