From 907bcb0e2f666c1c8cbc301d1e51072c378293e2 Mon Sep 17 00:00:00 2001 From: shashikanth Date: Thu, 14 Sep 2017 17:52:04 +0530 Subject: Fix Blocker/Critical sonar issues Fix Blocker/Critical sonar issues in ccsdk/sli/adaptors module https://sonar.onap.org/component_issues?id=org.onap.ccsdk.sli.adaptors%3Accsdk-sli-adaptors#resolved=false|severities=BLOCKER Deleted redundant code. Issue-Id: CCSDK-67 Change-Id: Iccdfc4815b7a28a6e95251c24e7196221f1b25df Signed-off-by: shashikanth.vh --- .../onap/ccsdk/sli/adaptors/aai/AAIService.java | 33 +++------------------- 1 file changed, 4 insertions(+), 29 deletions(-) (limited to 'aai-service') 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 bf5adc50..bea26328 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 @@ -849,7 +849,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe @Override public Complex requestNetworkComplexData(String pLocId) throws AAIServiceException { Complex response = null; - InputStream inputStream = null; try { AAIRequest request = AAIRequest.getRequestFromResource("complex"); @@ -865,14 +864,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } catch (Exception exc) { LOG.warn("requestNetworkComplexData", exc); throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - - } - } } return response; } @@ -1070,7 +1061,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe @Override public DvsSwitch requestDvsSwitchData(String vnf_id) throws AAIServiceException { DvsSwitch response = null; - InputStream inputStream = null; try { AAIRequest request = AAIRequest.getRequestFromResource("dvs-switch"); @@ -1086,14 +1076,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } catch (Exception exc) { LOG.warn("requestDvsSwitchData", exc); throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - - } - } } return response; } @@ -1902,7 +1884,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe @Override public L3Network requestL3NetworkQueryByName(String networkName) throws AAIServiceException { L3Network response = null; - InputStream inputStream = null; try { AAIRequest request = AAIRequest.getRequestFromResource("l3-network"); @@ -1919,14 +1900,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe } catch (Exception exc) { LOG.warn("requestL3NetworkQueryByName", exc); throw new AAIServiceException(exc); - } finally { - if(inputStream != null){ - try { - inputStream.close(); - } catch(Exception exc) { - - } - } } return response; } @@ -2167,7 +2140,8 @@ 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); @@ -2794,7 +2768,8 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe while( ( line = reader.readLine() ) != null ) { stringBuilder.append( line ); } - LOGwriteEndingTrace(responseCode, responseMessage, (stringBuilder != null) ? stringBuilder.toString() : "{no-data}"); + LOGwriteEndingTrace(responseCode, responseMessage, + (stringBuilder.length() > 0) ? stringBuilder.toString() : "{no-data}"); return true; } else { StringBuilder stringBuilder = new StringBuilder(); -- cgit 1.2.3-korg