summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-netconf-adapter
diff options
context:
space:
mode:
authorbeili.zhou <beili.zhou@amdocs.com>2017-08-29 18:33:57 -0400
committerMarcus Williams <marcus.williams@intel.com>2017-08-30 16:29:28 +0000
commita1194798f406efe32cb33510f1a9d58b0b5f9bd9 (patch)
tree21931fa9ba7e4023dd4d1998525e5529b944d209 /appc-adapters/appc-netconf-adapter
parent9a1e7032fae218bd820dc06436a52173fbae7d6e (diff)
Remove catch throwable and error
Fix the following sonar blocker issue: - Catch Exception instead of Throwable - Catch Exception instead of Error Issue-Id: APPC-175 Change-Id: I16a1018001b067216740ec11e5a97e52d714db69 Signed-off-by: beili.zhou <beili.zhou@amdocs.com>
Diffstat (limited to 'appc-adapters/appc-netconf-adapter')
-rw-r--r--appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/openecomp/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java30
1 files changed, 10 insertions, 20 deletions
diff --git a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/openecomp/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/openecomp/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java
index d55e3f5c2..04088166d 100644
--- a/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/openecomp/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java
+++ b/appc-adapters/appc-netconf-adapter/appc-netconf-adapter-bundle/src/main/java/org/openecomp/appc/adapter/netconf/internal/NetconfDataAccessServiceImpl.java
@@ -24,22 +24,19 @@
package org.openecomp.appc.adapter.netconf.internal;
-import javax.sql.rowset.CachedRowSet;
-
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
import org.openecomp.appc.adapter.netconf.ConnectionDetails;
import org.openecomp.appc.adapter.netconf.NetconfConnectionDetails;
import org.openecomp.appc.adapter.netconf.NetconfDataAccessService;
import org.openecomp.appc.adapter.netconf.exception.DataAccessException;
import org.openecomp.appc.adapter.netconf.util.Constants;
-import org.openecomp.appc.exceptions.APPCException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
+import javax.sql.rowset.CachedRowSet;
import java.sql.SQLException;
import java.util.ArrayList;
-
public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
private static EELFLogger logger = EELFManager.getInstance().getLogger(NetconfDataAccessServiceImpl.class);
@@ -66,13 +63,11 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
argList.add(xmlID);
try {
-
final CachedRowSet data = dbLibService.getData(queryString, argList, schema);
if (data.first()) {
fileContent = data.getString(Constants.FILE_CONTENT_TABLE_FIELD_NAME);
}
-
- } catch (Throwable e) {
+ } catch (Exception e) {
logger.error("Error Accessing Database " + e);
throw new DataAccessException(e);
}
@@ -85,7 +80,8 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
DataAccessException {
boolean recordFound = false;
- String queryString = "select " + Constants.USER_NAME_TABLE_FIELD_NAME + "," + Constants.PASSWORD_TABLE_FIELD_NAME + "," + Constants.PORT_NUMBER_TABLE_FIELD_NAME + " " +
+ String queryString = "select " + Constants.USER_NAME_TABLE_FIELD_NAME + "," +
+ Constants.PASSWORD_TABLE_FIELD_NAME + "," + Constants.PORT_NUMBER_TABLE_FIELD_NAME + " " +
"from " + Constants.DEVICE_AUTHENTICATION_TABLE_NAME + " " +
"where " + Constants.VNF_TYPE_TABLE_FIELD_NAME + " = ?";
@@ -93,7 +89,6 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
argList.add(vnfType);
try {
-
final CachedRowSet data = dbLibService.getData(queryString, argList, schema);
if (data.first()) {
connectionDetails.setUsername(data.getString(Constants.USER_NAME_TABLE_FIELD_NAME));
@@ -101,7 +96,6 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
connectionDetails.setPort(data.getInt(Constants.PORT_NUMBER_TABLE_FIELD_NAME));
recordFound = true;
}
-
} catch (SQLException e) {
logger.error("Error Accessing Database " + e);
throw new DataAccessException(e);
@@ -111,9 +105,8 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
}
@Override
- public boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails) throws
- DataAccessException
- {
+ public boolean retrieveNetconfConnectionDetails(String vnfType, NetconfConnectionDetails connectionDetails)
+ throws DataAccessException {
ConnectionDetails connDetails = new ConnectionDetails();
if(this.retrieveConnectionDetails(vnfType, connDetails))
{
@@ -126,9 +119,8 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
}
@Override
- public boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText) throws
- DataAccessException {
-
+ public boolean logDeviceInteraction(String instanceId, String requestId, String creationDate, String logText)
+ throws DataAccessException {
String queryString = "INSERT INTO "+ Constants.DEVICE_INTERFACE_LOG_TABLE_NAME+"("+
Constants.SERVICE_INSTANCE_ID_FIELD_NAME+","+
Constants.REQUEST_ID_FIELD_NAME+","+
@@ -143,9 +135,7 @@ public class NetconfDataAccessServiceImpl implements NetconfDataAccessService {
argList.add(logText);
try {
-
dbLibService.writeData(queryString, argList, schema);
-
} catch (SQLException e) {
logger.error("Logging Device interaction failed - "+ queryString);
throw new DataAccessException(e);