summaryrefslogtreecommitdiffstats
path: root/datarouter-prov
diff options
context:
space:
mode:
authorRonan Keogh <ronan.keogh@ericsson.com>2018-09-24 17:09:00 +0100
committerRonan Keogh <ronan.keogh@ericsson.com>2018-09-24 18:19:24 +0000
commit61f221fd62846149f7ddd70306e4eb51810a3aa6 (patch)
treeba62b3e320d6c0e2edd29884b1c7d48dc84ce1a8 /datarouter-prov
parent65d1d8df9cc905d813cfa45f3fbbe0cae4892919 (diff)
fix FeedReport vulnerabilities
Change-Id: I46f75ec2f92eec39ba532935aef15446477252a6 Signed-off-by: Ronan Keogh <ronan.keogh@ericsson.com> Issue-ID: DMAAP-775
Diffstat (limited to 'datarouter-prov')
-rw-r--r--datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java
index fe9c4601..3f67efec 100644
--- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java
+++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/FeedReport.java
@@ -83,7 +83,7 @@ public class FeedReport extends ReportBase {
}
db.release(conn);
} catch (SQLException e) {
- e.printStackTrace();
+ logger.error(e);
}
logger.debug("Query time: " + (System.currentTimeMillis() - start) + " ms");
try (PrintWriter os = new PrintWriter(outfile)) {
@@ -91,6 +91,7 @@ public class FeedReport extends ReportBase {
os.print(sb.toString());
} catch (FileNotFoundException e) {
System.err.println("File cannot be written: " + outfile);
+ logger.error(e);
}
}
@@ -129,6 +130,7 @@ public class FeedReport extends ReportBase {
feedmap.put("pubcount", n + 1);
} catch (JSONException e) {
feedmap.put("pubcount", 1);
+ logger.error(e);
}
} else if (type.equals("del")) {
String subid = "" + rs.getInt("DELIVERY_SUBID");
@@ -137,6 +139,7 @@ public class FeedReport extends ReportBase {
feedmap.put(subid, n + 1);
} catch (JSONException e) {
feedmap.put(subid, 1);
+ logger.error(e);
}
}
}
@@ -144,7 +147,7 @@ public class FeedReport extends ReportBase {
}
db.release(conn);
} catch (SQLException e) {
- e.printStackTrace();
+ logger.error(e);
}
logger.debug("Query time: " + (System.currentTimeMillis() - start) + " ms");
try {
@@ -153,6 +156,7 @@ public class FeedReport extends ReportBase {
os.close();
} catch (FileNotFoundException e) {
System.err.println("File cannot be written: " + outfile);
+ logger.error(e);
}
}
@@ -279,7 +283,7 @@ public class FeedReport extends ReportBase {
*
* @param args
*/
- public static void main(String[] args) {
+ public void main(String[] args) {
int rtype = 0; // 0 -> day, 1 -> week, 2 -> month, 3 -> year
String infile = null;
String outfile = null;
@@ -350,6 +354,7 @@ public class FeedReport extends ReportBase {
feedmap.put("pubcount", n + count);
} catch (JSONException e) {
feedmap.put("pubcount", count);
+ logger.error(e);
}
} else if (type.equals("del")) {
String subid = tt[3];
@@ -358,6 +363,7 @@ public class FeedReport extends ReportBase {
feedmap.put(subid, n + count);
} catch (JSONException e) {
feedmap.put(subid, count);
+ logger.error(e);
}
}
}
@@ -379,7 +385,7 @@ public class FeedReport extends ReportBase {
System.out.println(t);
} catch (Exception e) {
System.err.println(e);
- e.printStackTrace();
+ logger.error(e);
}
}
}