summaryrefslogtreecommitdiffstats
path: root/datarouter-prov/src/main
diff options
context:
space:
mode:
authoresobmar <mariusz.sobucki@ericsson.com>2018-09-27 11:24:27 +0100
committeresobmar <mariusz.sobucki@ericsson.com>2018-09-27 11:24:41 +0100
commit8b7c38f1f0b9fc156e9776584767624b13c8ed99 (patch)
tree7b96bedf86b4ae8a7a05ad218e0040206efb7025 /datarouter-prov/src/main
parenteb4080be2d6c5e2bf396e653f3fcd00f2747cce6 (diff)
Fix logging and formatting fot NetworkRoute
Change-Id: I70b2f851a84630ae3ebeb13a00338e13a6921e16 Signed-off-by: Mariusz Sobucki <mariusz.sobucki@ericsson.com> Issue-ID: DMAAP-775
Diffstat (limited to 'datarouter-prov/src/main')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java
index bad6f537..8264de28 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NetworkRoute.java
@@ -44,14 +44,15 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB;
* @version $Id: NetworkRoute.java,v 1.2 2013/12/16 20:30:23 eby Exp $
*/
public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute> {
+
private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal");
private final int fromnode;
private final int tonode;
private final int vianode;
/**
- * Get a set of all Network Routes in the DB. The set is sorted according to the natural sorting order
- * of the routes (based on the from and to node names in each route).
+ * Get a set of all Network Routes in the DB. The set is sorted according to the natural sorting order of the
+ * routes (based on the from and to node names in each route).
*
* @return the sorted set
*/
@@ -61,8 +62,8 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute>
DB db = new DB();
@SuppressWarnings("resource")
Connection conn = db.getConnection();
- try(Statement stmt = conn.createStatement()) {
- try(ResultSet rs = stmt.executeQuery("select FROMNODE, TONODE, VIANODE from NETWORK_ROUTES")) {
+ try (Statement stmt = conn.createStatement()) {
+ try (ResultSet rs = stmt.executeQuery("select FROMNODE, TONODE, VIANODE from NETWORK_ROUTES")) {
while (rs.next()) {
int fromnode = rs.getInt("FROMNODE");
int tonode = rs.getInt("TONODE");
@@ -127,10 +128,9 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute>
} catch (SQLException e) {
rv = false;
intlogger.warn("PROV0007 doDelete: " + e.getMessage());
- intlogger.error("SQLException " + e.getMessage());
} finally {
try {
- if(ps!=null) {
+ if (ps != null) {
ps.close();
}
} catch (SQLException e) {
@@ -157,10 +157,9 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute>
rv = true;
} catch (SQLException e) {
intlogger.warn("PROV0005 doInsert: " + e.getMessage());
- intlogger.error("SQLException " + e.getMessage());
} finally {
try {
- if(ps!=null) {
+ if (ps != null) {
ps.close();
}
} catch (SQLException e) {
@@ -185,10 +184,9 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute>
} catch (SQLException e) {
rv = false;
intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
- intlogger.error("SQLException " + e.getMessage());
} finally {
try {
- if(ps!=null) {
+ if (ps != null) {
ps.close();
}
} catch (SQLException e) {
@@ -214,8 +212,9 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute>
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof NetworkRoute))
+ if (!(obj instanceof NetworkRoute)) {
return false;
+ }
NetworkRoute on = (NetworkRoute) obj;
return (fromnode == on.fromnode) && (tonode == on.tonode) && (vianode == on.vianode);
}
@@ -228,8 +227,9 @@ public class NetworkRoute extends NodeClass implements Comparable<NetworkRoute>
@Override
public int compareTo(NetworkRoute o) {
if (this.fromnode == o.fromnode) {
- if (this.tonode == o.tonode)
+ if (this.tonode == o.tonode) {
return this.vianode - o.vianode;
+ }
return this.tonode - o.tonode;
}
return this.fromnode - o.fromnode;