diff options
author | Jegadeesh Babu <jegabab1@in.ibm.com> | 2019-03-21 21:52:29 +0530 |
---|---|---|
committer | Jegadeesh Babu <jegabab1@in.ibm.com> | 2019-03-21 16:28:20 +0000 |
commit | 1e538efce498a934d52e074f095838229b9cd1af (patch) | |
tree | f8e98a965eb4718e97b3e14decb303e1d3ad3771 /appc-inbound/appc-design-services/provider/src/main/java | |
parent | 0a4c5940e9757e422adc24d84044d742563b0829 (diff) |
Modified code to avoid null pointer exception
Sonar fix
Issue-ID: APPC-1550
Change-Id: I6c6afcf13e33f06d70883a588574ed83a9e2dfdc
Signed-off-by: Jegadeesh Babu <jegabab1@in.ibm.com>
Diffstat (limited to 'appc-inbound/appc-design-services/provider/src/main/java')
-rw-r--r-- | appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java index 4e6375b91..2353e6b0c 100644 --- a/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java +++ b/appc-inbound/appc-design-services/provider/src/main/java/org/onap/appc/design/dbervices/DesignDBService.java @@ -7,6 +7,7 @@ * Copyright (C) 2017 Amdocs * ================================================================================ * Modifications (C) 2019 Ericsson + * Modifications (C) 2019 IBM * ============================================================================= * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -185,10 +186,12 @@ public class DesignDBService { throw new DBException( "Error occured while validating/Saving the artifact to SDC_ARTIFACTS or getting SDC_ARTIFACTS_ID ."); JsonNode json = payloadObject.get(DesignServiceConstants.USER_ID); - if (json == null || json.asText().trim().isEmpty()) { - log.info("UserId in Admin Aritfact is null or blank, User Id : " + json.asText()); - throw new DBException("User Id is null or blank"); - } + if (json == null) { + throw new DBException("User Id is null"); + } else if (json.asText().trim().isEmpty()) { + log.info("UserId in Admin Aritfact is blank, User Id : " + json.asText()); + throw new DBException("User Id is blank"); + } int sdcReferenceId = 0; createArtifactTrackingRecord(payload, requestId, sdcArtifactId, sdcReferenceId); |