summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorParshad Patel <pars.patel@samsung.com>2018-07-24 19:15:27 +0900
committerParshad Patel <pars.patel@samsung.com>2018-07-25 10:28:50 +0900
commit47099b56dcecba622e574b37c0167a061d6f667b (patch)
treefe2cc455332142d03ec1c2fcdb021b5df5d9788c
parentcfabda23cb6dc6c98e3266228f3bd2f409591a2f (diff)
Fix sonar issues
Fix sonar issues in ccsdk/sli/core Issue-ID: CCSDK-332 Change-Id: I2aee69cf410d8f9cb63f3a22aeb793a99e27d2c7 Signed-off-by: Parshad Patel <pars.patel@samsung.com>
-rwxr-xr-xdblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java7
-rw-r--r--filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/RequestResponseLoggingFilter.java2
-rw-r--r--sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java2
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java2
-rw-r--r--sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java12
5 files changed, 12 insertions, 13 deletions
diff --git a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
index 97380f58..f3ecfa27 100755
--- a/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
+++ b/dblib/provider/src/main/java/org/onap/ccsdk/sli/core/dblib/CachedDataSource.java
@@ -214,10 +214,8 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
throws SQLException {
long time = System.currentTimeMillis();
- CachedRowSet data;
-
- try (PreparedStatement ps = conn.prepareStatement(statement)) {
- data = RowSetProvider.newFactory().createCachedRowSet();
+ try (PreparedStatement ps = conn.prepareStatement(statement);
+ CachedRowSet data = RowSetProvider.newFactory().createCachedRowSet()) {
if (arguments != null) {
prepareStatementForExecuteUpdate(arguments, ps);
}
@@ -227,7 +225,6 @@ public abstract class CachedDataSource implements DataSource, SQLExecutionMonito
LOGGER.debug("SQL SUCCESS. rows returned: {}, time(ms): {}", data.size(),
(System.currentTimeMillis() - time));
}
- ps.close();
} catch (SQLException exc) {
handleSqlExceptionForExecuteStatement(conn, statement, arguments, exc, time);
} finally {
diff --git a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/RequestResponseLoggingFilter.java b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/RequestResponseLoggingFilter.java
index ffe6d71d..f5510b9a 100644
--- a/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/RequestResponseLoggingFilter.java
+++ b/filters/provider/src/main/java/org/onap/ccsdk/sli/core/filters/RequestResponseLoggingFilter.java
@@ -166,7 +166,7 @@ public class RequestResponseLoggingFilter implements Filter {
bais = new ByteArrayInputStream(buffer);
bsis = new BufferedServletInputStream(bais);
} catch (Exception ex) {
- ex.printStackTrace();
+ log.error("Exception in getInputStream",ex);
}
return bsis;
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java
index c229cf59..d275e970 100644
--- a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java
+++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/SvcLogicExpressionFactory.java
@@ -93,7 +93,7 @@ public class SvcLogicExpressionFactory {
try {
SvcLogicExpressionFactory.parse(sbuff.toString());
} catch (IOException e) {
- e.printStackTrace();
+ LOG.error("Exception in SvcLogicExpressionFactory.parse",e);
}
}
}
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java
index 6c6b4ca2..a73fadcf 100644
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ForNodeExecutor.java
@@ -101,7 +101,7 @@ public class ForNodeExecutor extends SvcLogicNodeExecutor {
}
}
} catch (BreakNodeException br) {
- LOG.debug("ForNodeExecutor caught break");
+ LOG.error("ForNodeExecutor caught break",br);
}
return (null);
}
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
index e50b9974..f7a229d5 100644
--- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
+++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/MdsalHelper.java
@@ -1117,8 +1117,11 @@ public class MdsalHelper {
Class returnClass = m.getReturnType();
String fieldName = toLowerHyphen(m.getName().substring(3));
- fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
-
+ if(fieldName!=null) {
+ fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
+ }else {
+ fieldName="";
+ }
String propName = propNamePfx + "." + fieldName;
// Is the return type a yang generated class?
@@ -1182,11 +1185,10 @@ public class MdsalHelper {
}
public static boolean isYangGenerated(Class c) {
- if (c == null) {
- return (false);
- } else {
+ if (c != null) {
return (c.getName().startsWith("org.opendaylight.yang.gen."));
}
+ return false;
}
public static boolean isIpPrefix(Class c) {