summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsurya-huawei <a.u.surya@huawei.com>2017-09-11 15:16:36 +0530
committerSURYA A U <a.u.surya@huawei.com>2017-09-13 11:20:32 +0000
commit214cb38f182ed7d7b1d19da0603df0a894a2db85 (patch)
tree59d414ec828ea4c54f13b4e1c1e0727942414d4a
parent56f4e851689c21e2f0f30e39f8b773de2acbcecc (diff)
Fix Sonar issues
Few major issues in adapters/aai module Issue-id: CCSDK-67 Change-Id: I76d9576b742f846e3259ffe9bfaf1845d64abadb Signed-off-by: surya-huawei <a.u.surya@huawei.com>
-rw-r--r--aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java69
1 files changed, 43 insertions, 26 deletions
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 1c63d2f6c..bf5adc500 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
@@ -182,7 +182,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
LOG.info("Entered AAIService.ctor");
String runtime = System.getProperty("aaiclient.runtime");
- if(runtime != null && runtime.equals("OSGI")) {
+ if("OSGI".equals(runtime)) {
runtimeOSGI = true;
} else {
runtimeOSGI = false;
@@ -306,7 +306,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
String extension = keystore_path.substring(keystore_path.lastIndexOf(".") + 1);
- if(extension != null && !extension.isEmpty() && extension.equalsIgnoreCase("JKS")) {
+ if("JKS".equalsIgnoreCase(extension)) {
storeType = "JKS";
}
KeyStore ks = KeyStore.getInstance(storeType);
@@ -422,7 +422,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
@@ -480,7 +480,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
@@ -588,7 +588,6 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
try {
inputStream.close();
} catch(Exception exc) {
-
}
}
}
@@ -752,7 +751,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
return response;
@@ -769,7 +768,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
}
@@ -785,7 +784,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
return response;
@@ -807,7 +806,8 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(),
+ exc);
throw new AAIServiceException(exc);
}
return response;
@@ -935,7 +935,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
return response;
@@ -1109,7 +1109,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
}
@@ -1166,7 +1166,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
}
@@ -1205,7 +1205,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
return response;
@@ -1318,7 +1318,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
return response;
@@ -1620,76 +1620,92 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
}
/* DELETE */
+ @Override
public boolean dataChangeDeleteVServerData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
+ @Override
public boolean dataChangeDeleteCtagPoolData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
+ @Override
public boolean dataChangeDeleteVplsPeData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
+ @Override
public boolean dataChangeDeleteVpeData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
+ @Override
public boolean dataChangeDeleteDvsSwitchData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
//OAM-Network:
+ @Override
public boolean dataChangeDeleteOAMNetworkData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
//Availability-Zone:
+ @Override
public boolean dataChangeDeleteAvailabilityZoneData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
//Complex:
+ @Override
public boolean dataChangeDeleteComplexData(URL url) throws AAIServiceException {
if(url == null) {
throw new NullPointerException();
}
- return deleteAAIEntity(url, new Object(){}.getClass().getEnclosingMethod().getName());
+ return deleteAAIEntity(url, Object.class.getClass().getEnclosingMethod()
+ .getName());
}
private boolean deleteAAIEntity(URL url, String caller) throws AAIServiceException {
@@ -1836,7 +1852,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
}
@@ -1926,7 +1942,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
} catch(AAIServiceException aaiexc) {
throw aaiexc;
} catch (Exception exc) {
- LOG.warn(new Object(){}.getClass().getEnclosingMethod().getName(), exc);
+ LOG.warn(Object.class.getClass().getEnclosingMethod().getName(), exc);
throw new AAIServiceException(exc);
}
}
@@ -2682,7 +2698,8 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
String requestId = UUID.randomUUID().toString();
try {
- con = getConfiguredConnection(requestUrl = request.getRequestQueryUrl(HttpMethod.GET), HttpMethod.GET);
+ requestUrl = request.getRequestQueryUrl(HttpMethod.GET);
+ con = getConfiguredConnection(requestUrl , HttpMethod.GET);
logMetricRequest(requestId, "GET "+requestUrl.getPath(), "", requestUrl.getPath());
// Check for errors
@@ -3292,7 +3309,7 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe
if(clazz == null)
return key;
- List<String> fieldAnnotatedNames = new LinkedList<String>();
+ List<String> fieldAnnotatedNames = new LinkedList<>();
Field[] fields = clazz.getDeclaredFields();
for(Field field : fields) {