From 4769fc2a7dfd4faadb682a5a9c28157a9c824c37 Mon Sep 17 00:00:00 2001 From: "ramu.n" Date: Thu, 7 Sep 2017 21:30:29 +0530 Subject: 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 --- .../org/onap/ccsdk/sli/adaptors/aai/AAIDeclarations.java | 7 ++----- .../java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java | 16 ++++++++-------- .../onap/ccsdk/sli/adaptors/aai/AAIServiceActivator.java | 12 ++++++------ 3 files changed, 16 insertions(+), 19 deletions(-) (limited to 'aai-service') 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 f8bfe78f..1d7fbd16 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 3090e498..1c63d2f6 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 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 6ce685db..ef1bc02d 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 { -- cgit 1.2.3-korg