X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2Fbeans%2FEgressRoute.java;h=1213596997815b59f6839e4e8e0dc3b4eb902129;hb=refs%2Fchanges%2F51%2F78851%2F11;hp=242c1053e54145715cb19c6cf7768f04308d956b;hpb=478e29d6504d776e139468b381548ecfa58c7518;p=dmaap%2Fdatarouter.git diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java index 242c1053..12135969 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/EgressRoute.java @@ -33,7 +33,8 @@ import java.util.Objects; import java.util.SortedSet; import java.util.TreeSet; -import org.apache.log4j.Logger; +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; import org.json.JSONObject; import org.onap.dmaap.datarouter.provisioning.utils.DB; @@ -44,13 +45,14 @@ import org.onap.dmaap.datarouter.provisioning.utils.DB; * @version $Id: EgressRoute.java,v 1.3 2013/12/16 20:30:23 eby Exp $ */ public class EgressRoute extends NodeClass implements Comparable { - private static Logger intlogger = Logger.getLogger("org.onap.dmaap.datarouter.provisioning.internal"); + + private static EELFLogger intlogger = EELFManager.getInstance().getLogger("InternalLog"); private final int subid; private final int nodeid; /** - * Get a set of all Egress Routes in the DB. The set is sorted according to the natural sorting order - * of the routes (based on the subscription ID in each route). + * Get a set of all Egress Routes in the DB. The set is sorted according to the natural sorting order of the routes + * (based on the subscription ID in each route). * * @return the sorted set */ @@ -60,15 +62,15 @@ public class EgressRoute extends NodeClass implements Comparable { DB db = new DB(); @SuppressWarnings("resource") Connection conn = db.getConnection(); - try( Statement stmt = conn.createStatement()) { - try(ResultSet rs = stmt.executeQuery("select SUBID, NODEID from EGRESS_ROUTES")) { - while (rs.next()) { - int subid = rs.getInt("SUBID"); - int nodeid = rs.getInt("NODEID"); - set.add(new EgressRoute(subid, nodeid)); - } - } - } + try (Statement stmt = conn.createStatement()) { + try (ResultSet rs = stmt.executeQuery("select SUBID, NODEID from EGRESS_ROUTES")) { + while (rs.next()) { + int subid = rs.getInt("SUBID"); + int nodeid = rs.getInt("NODEID"); + set.add(new EgressRoute(subid, nodeid)); + } + } + } db.release(conn); } catch (SQLException e) { @@ -93,7 +95,7 @@ public class EgressRoute extends NodeClass implements Comparable { String sql = "select NODEID from EGRESS_ROUTES where SUBID = ?"; ps = conn.prepareStatement(sql); ps.setInt(1, sub); - try(ResultSet rs = ps.executeQuery()) { + try (ResultSet rs = ps.executeQuery()) { if (rs.next()) { int node = rs.getInt("NODEID"); v = new EgressRoute(sub, node); @@ -105,7 +107,7 @@ public class EgressRoute extends NodeClass implements Comparable { intlogger.error("SQLException " + e.getMessage()); } finally { try { - if(ps!=null) { + if (ps != null) { ps.close(); } } catch (SQLException e) { @@ -143,7 +145,7 @@ public class EgressRoute extends NodeClass implements Comparable { intlogger.error("SQLException " + e.getMessage()); } finally { try { - if(ps!=null) { + if (ps != null) { ps.close(); } } catch (SQLException e) { @@ -168,10 +170,9 @@ public class EgressRoute extends NodeClass implements Comparable { 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) { @@ -194,10 +195,9 @@ public class EgressRoute extends NodeClass implements Comparable { } 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) { @@ -221,8 +221,9 @@ public class EgressRoute extends NodeClass implements Comparable { @Override public boolean equals(Object obj) { - if (!(obj instanceof EgressRoute)) + if (!(obj instanceof EgressRoute)) { return false; + } EgressRoute on = (EgressRoute) obj; return (subid == on.subid) && (nodeid == on.nodeid); }