Fix Blocker/Critical sonar issues 93/14193/1
authorshashikanth <shashikanth.vh@huawei.com>
Thu, 21 Sep 2017 09:39:59 +0000 (15:09 +0530)
committershashikanth <shashikanth.vh@huawei.com>
Thu, 21 Sep 2017 09:40:00 +0000 (15:10 +0530)
Fix Major sonar issues in aai/traversal module
https://sonar.onap.org/component_issues?id=org.onap.aai.traversal%3Atraversal#resolved=false|severities=BLOCKER

Fixed NullPointerException might be thrown as 'uri' is nullable here

Issue-Id:AAI-212
Change-Id: Ie4f47a47c3d54a4356aad787dcc10acbfcdd87ea
Signed-off-by: shashikanth.vh <shashikanth.vh@huawei.com>
aai-traversal/src/main/java/org/openecomp/aai/interceptors/AAILogJAXRSInInterceptor.java

index a0ddeff..dd718de 100644 (file)
@@ -94,7 +94,7 @@ public class AAILogJAXRSInInterceptor extends JAXRSInInterceptor {
                        ErrorLogHelper.logException(e1);
                }
                
-               if (uri.contains(EchoResponse.echoPath)) {
+               if ((uri != null) && (uri.contains(EchoResponse.echoPath))) {
                        // if it's a health check, we don't want to log ANYTHING if it's a lightweight one
                        if (query == null) {
                                if (message.getExchange().containsKey("AAI_LOGGING_HBASE_ENABLED")) {
@@ -106,7 +106,7 @@ public class AAILogJAXRSInInterceptor extends JAXRSInInterceptor {
                                go = false;
                        }
                }
-               else if (uri.contains("/translog/")) {
+               else if ((uri != null) && (uri.contains("/translog/"))) {
                        // if it's a translog query, we don't want to log the responses
                        if (message.getExchange().containsKey("AAI_LOGGING_HBASE_LOGRESPONSE")) {
                                message.getExchange().remove("AAI_LOGGING_HBASE_LOGRESPONSE");