diff options
author | ramu.n <ramu.n@huawei.com> | 2017-09-07 21:30:29 +0530 |
---|---|---|
committer | Ramu N <ramu.n@huawei.com> | 2017-09-07 19:59:16 +0000 |
commit | 4769fc2a7dfd4faadb682a5a9c28157a9c824c37 (patch) | |
tree | 429f50f7607a9a2a390881c92bdc2428118fe396 | |
parent | 9dcdfb51240411c7623f3851073dbbae9ed0ded6 (diff) |
Fix few Blocker sonar issues
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>
3 files changed, 16 insertions, 19 deletions
diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java index f8bfe78f3..1d7fbd167 100644 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java @@ -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) { diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java index 3090e4981..1c63d2f6c 100644 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java @@ -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); diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java index 6ce685db0..ef1bc02d9 100644 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java @@ -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 { |