Fix few Blocker sonar issues 79/10879/4
authorramu.n <ramu.n@huawei.com>
Thu, 7 Sep 2017 16:00:29 +0000 (21:30 +0530)
committerRamu N <ramu.n@huawei.com>
Thu, 7 Sep 2017 19:59:16 +0000 (19:59 +0000)
Fix few Blocker sonar issues in CCSDK SLI Adaptors
https://sonar.onap.org/component_issues?id=org.onap.ccsdk.sli.adaptors%3Accsdk-sli-adaptors#resolved=false|severities=BLOCKER

Change-Id: I74d781a19f849fc83bb07dbfb795dde356159b45
Issue-Id: CCSDK-67
Signed-off-by: Ramu N <ramu.n@huawei.com>
aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java
aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java
aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java

index f8bfe78..1d7fbd1 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -700,9 +700,6 @@ public abstract class AAIDeclarations implements AAIClient {
                        String resoourceName = resource;
                        String identifier = null;
 
-                       if(resoourceName == null)
-                               return QueryStatus.FAILURE;
-
                        if(resoourceName.contains(":")) {
                                String[] tokens = resoourceName.split(":");
                                if(tokens != null && tokens.length > 0) {
index 3090e49..1c63d2f 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -1261,7 +1261,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
                                while( ( line = reader.readLine() ) != null ) {
                                        stringBuilder.append( line );
                                }
-                               LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder != null) ? stringBuilder.toString() : "{no-data}");
+                               LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}");
                                return true;
             } else {
                ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
@@ -1371,7 +1371,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
                                while( ( line = reader.readLine() ) != null ) {
                                        stringBuilder.append( line );
                                }
-                               LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder != null) ? stringBuilder.toString() : "{no-data}");
+                               LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}");
                                return true;
             } else {
                ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
@@ -1484,7 +1484,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
                                while( ( line = reader.readLine() ) != null ) {
                                        stringBuilder.append( line );
                                }
-                               LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder != null) ? stringBuilder.toString() : "{no-data}");
+                               LOGwriteEndingTrace(responseCode, "SUCCESS", (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}");
                                return true;
             } else {
                ErrorResponse errorresponse = mapper.readValue(reader, ErrorResponse.class);
@@ -3043,7 +3043,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
                    return true;
                }
 
-       
+
        public boolean isValidURI(String url) {
 
                URI u = null;
@@ -3057,7 +3057,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
                return true;
        }
 
-       
+
        @Override
        protected boolean deleteRelationshipList(URL httpReqUrl, String json_text) throws AAIServiceException {
                if(httpReqUrl ==  null) {
@@ -3329,7 +3329,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
        public String getPathTemplateForResource(String resoourceName, String keys, SvcLogicContext ctx) throws MalformedURLException {
                return AAIServiceUtils.getPathForResource(resoourceName, StringUtils.join(keys, " AND "), ctx);
        }
-       
+
        @Override
        public boolean isDeprecatedFormat(String resource, HashMap<String, String> nameValues) {
                return !AAIServiceUtils.isValidFormat(resource, nameValues);
index 6ce685d..ef1bc02 100644 (file)
@@ -8,9 +8,9 @@
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -157,13 +157,13 @@ public class AAIServiceActivator implements BundleActivator {
                if (sdnConfigDirectory == null || sdnConfigDirectory.isEmpty()) {
                        String filename = DEFAULT_SDNC_PROPERTY_FILE;
                File file = new File(filename);
-               if(file != null && file.exists()) {
+               if(file.exists()) {
                        propertiesPath = filename;
                        LOG.info("Using property file (1): " + propertiesPath);
                } else {
                        filename = BVC_PROPERTY_FILE;
                        file = new File(filename);
-                       if(file != null && file.exists()) {
+                       if(file.exists()) {
                                propertiesPath = filename;
                                LOG.info("Using property file (1): " + propertiesPath);
                        } else {
@@ -179,13 +179,13 @@ public class AAIServiceActivator implements BundleActivator {
                if(!propFile.exists()) {
                        String filename = DEFAULT_SDNC_PROPERTY_FILE;
                File file = new File(filename);
-               if(file != null && file.exists()) {
+               if(file.exists()) {
                        propertiesPath = filename;
                        LOG.info("Using property file (1): " + propertiesPath);
                } else {
                        filename = BVC_PROPERTY_FILE;
                        file = new File(filename);
-                       if(file != null && file.exists()) {
+                       if(file.exists()) {
                                propertiesPath = filename;
                                LOG.info("Using property file (1): " + propertiesPath);
                        } else {