X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=datarouter-prov%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fdmaap%2Fdatarouter%2Fprovisioning%2Fbeans%2FFeed.java;h=f18734243fbc3f413e2028bec350fd4292feaea5;hb=85b8739b9f1ebdf9731b134ac2b2796c0e2e5178;hp=c08bce57b59f2cbb6d3a12537cdf8bbc0600db99;hpb=dffdd1d82c6aa0adfb7a24703af48870f182ccfa;p=dmaap%2Fdatarouter.git diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java index c08bce57..f1873424 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Feed.java @@ -72,8 +72,9 @@ public class Feed extends Syncable { try { DB db = new DB(); Connection conn = db.getConnection(); - try(Statement stmt = conn.createStatement()) { - try(ResultSet rs = stmt.executeQuery("select COUNT(*) from FEEDS where FEEDID = " + id)) { + try(PreparedStatement stmt = conn.prepareStatement("select COUNT(*) from FEEDS where FEEDID = ?")) { + stmt.setInt(1, id); + try(ResultSet rs = stmt.executeQuery()) { if (rs.next()) { count = rs.getInt(1); } @@ -81,7 +82,7 @@ public class Feed extends Syncable { } db.release(conn); } catch (SQLException e) { - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } return count != 0; } @@ -132,7 +133,7 @@ public class Feed extends Syncable { db.release(conn); } catch (SQLException e) { intlogger.info("countActiveFeeds: " + e.getMessage()); - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } return count; } @@ -153,7 +154,7 @@ public class Feed extends Syncable { db.release(conn); } catch (SQLException e) { intlogger.info("getMaxFeedID: " + e.getMessage()); - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } return max; } @@ -199,7 +200,7 @@ public class Feed extends Syncable { } db.release(conn); } catch (SQLException e) { - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } return map.values(); } @@ -233,7 +234,7 @@ public class Feed extends Syncable { } db.release(conn); } catch (SQLException e) { - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } return list; } @@ -270,7 +271,7 @@ public class Feed extends Syncable { } db.release(conn); } catch (SQLException e) { - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } return feed; } @@ -533,14 +534,14 @@ public class Feed extends Syncable { } catch (SQLException e) { rv = false; intlogger.warn("PROV0007 doDelete: " + e.getMessage()); - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } finally { try { if(ps!=null) { ps.close(); } } catch (SQLException e) { - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } } return rv; @@ -601,7 +602,7 @@ public class Feed extends Syncable { } catch (SQLException e) { rv = false; intlogger.warn("PROV0005 doInsert: " + e.getMessage()); - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } return rv; } @@ -682,13 +683,12 @@ public class Feed extends Syncable { } catch (SQLException e) { rv = false; intlogger.warn("PROV0006 doUpdate: " + e.getMessage()); - e.printStackTrace(); } finally { try { if (ps != null) ps.close(); } catch (SQLException e) { - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } } return rv; @@ -715,14 +715,13 @@ public class Feed extends Syncable { } catch (SQLException e) { rv = false; intlogger.warn("PROV0006 doUpdate: " + e.getMessage()); - e.printStackTrace(); } finally { try { if(ps!=null) { ps.close(); } } catch (SQLException e) { - e.printStackTrace(); + intlogger.error("SQLException " + e.getMessage()); } } return rv;