diff options
author | Ram Koya <rk541m@att.com> | 2018-09-26 15:45:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-26 15:45:36 +0000 |
commit | eb4080be2d6c5e2bf396e653f3fcd00f2747cce6 (patch) | |
tree | 592bed39e28b658e31988347cc1eb1d03dedffd1 /datarouter-prov/src/main/java | |
parent | b6272800c94bab63eff623034bbc5bd2ded7b4d4 (diff) | |
parent | 9f890296feed36d09c05eea3f0064a1b8b54f260 (diff) |
Merge changes I2edbb6b3,I0774c1a5
* changes:
Fix DailyLatencyReport Vulnerabilities
Fix Parameters Vulnerabilities
Diffstat (limited to 'datarouter-prov/src/main/java')
2 files changed, 25 insertions, 25 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java index b2378218..4d2c9d1f 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Parameters.java @@ -35,13 +35,14 @@ import org.json.JSONObject; import org.onap.dmaap.datarouter.provisioning.utils.DB;
/**
- * Methods to provide access to Provisioning parameters in the DB.
- * This class also provides constants of the standard parameters used by the Data Router.
+ * Methods to provide access to Provisioning parameters in the DB. This class also provides constants of the standard
+ * parameters used by the Data Router.
*
* @author Robert Eby
* @version $Id: Parameters.java,v 1.11 2014/03/12 19:45:41 eby Exp $
*/
public class Parameters extends Syncable {
+
public static final String PROV_REQUIRE_SECURE = "PROV_REQUIRE_SECURE";
public static final String PROV_REQUIRE_CERT = "PROV_REQUIRE_CERT";
public static final String PROV_AUTH_ADDRESSES = "PROV_AUTH_ADDRESSES";
@@ -90,9 +91,9 @@ public class Parameters extends Syncable { DB db = new DB();
@SuppressWarnings("resource")
Connection conn = db.getConnection();
- try(Statement stmt = conn.createStatement()) {
+ try (Statement stmt = conn.createStatement()) {
String sql = "select * from PARAMETERS";
- try(ResultSet rs = stmt.executeQuery(sql)) {
+ try (ResultSet rs = stmt.executeQuery(sql)) {
while (rs.next()) {
Parameters p = new Parameters(rs);
coll.add(p);
@@ -101,7 +102,7 @@ public class Parameters extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- e.printStackTrace();
+ intlogger.error("SQLException " + e.getMessage());
}
return coll;
}
@@ -118,9 +119,10 @@ public class Parameters extends Syncable { DB db = new DB();
@SuppressWarnings("resource")
Connection conn = db.getConnection();
- try(PreparedStatement stmt = conn.prepareStatement("select KEYNAME, VALUE from PARAMETERS where KEYNAME = ?")) {
+ try (PreparedStatement stmt = conn
+ .prepareStatement("select KEYNAME, VALUE from PARAMETERS where KEYNAME = ?")) {
stmt.setString(1, k);
- try(ResultSet rs = stmt.executeQuery()) {
+ try (ResultSet rs = stmt.executeQuery()) {
if (rs.next()) {
v = new Parameters(rs);
}
@@ -128,7 +130,7 @@ public class Parameters extends Syncable { }
db.release(conn);
} catch (SQLException e) {
- e.printStackTrace();
+ intlogger.error("SQLException " + e.getMessage());
}
return v;
}
@@ -185,14 +187,13 @@ public class Parameters extends Syncable { } catch (SQLException e) {
rv = false;
intlogger.warn("PROV0005 doInsert: " + e.getMessage());
- e.printStackTrace();
} finally {
try {
- if(ps!=null) {
+ if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- e.printStackTrace();
+ intlogger.error("SQLException " + e.getMessage());
}
}
return rv;
@@ -212,14 +213,13 @@ public class Parameters extends Syncable { } catch (SQLException e) {
rv = false;
intlogger.warn("PROV0006 doUpdate: " + e.getMessage());
- e.printStackTrace();
} finally {
try {
- if(ps!=null) {
+ if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- e.printStackTrace();
+ intlogger.error("SQLException " + e.getMessage());
}
}
return rv;
@@ -238,14 +238,13 @@ public class Parameters extends Syncable { } catch (SQLException e) {
rv = false;
intlogger.warn("PROV0007 doDelete: " + e.getMessage());
- e.printStackTrace();
} finally {
try {
- if(ps!=null) {
+ if (ps != null) {
ps.close();
}
} catch (SQLException e) {
- e.printStackTrace();
+ intlogger.error("SQLException " + e.getMessage());
}
}
return rv;
@@ -258,13 +257,16 @@ public class Parameters extends Syncable { @Override
public boolean equals(Object obj) {
- if (!(obj instanceof Parameters))
+ if (!(obj instanceof Parameters)) {
return false;
+ }
Parameters of = (Parameters) obj;
- if (!keyname.equals(of.keyname))
+ if (!keyname.equals(of.keyname)) {
return false;
- if (!value.equals(of.value))
+ }
+ if (!value.equals(of.value)) {
return false;
+ }
return true;
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/DailyLatencyReport.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/DailyLatencyReport.java index f1e0f7cc..2f08b176 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/DailyLatencyReport.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/reports/DailyLatencyReport.java @@ -70,11 +70,9 @@ public class DailyLatencyReport extends ReportBase { " where EVENT_TIME >= ? and EVENT_TIME <= ?";
private class Job {
-
- public long pubtime = 0;
- public long clen = 0;
- public List<Long> deltime = new ArrayList<Long>();
-
+ private long pubtime = 0;
+ private long clen = 0;
+ private List<Long> deltime = new ArrayList<>();
public long minLatency() {
long n = deltime.isEmpty() ? 0 : Long.MAX_VALUE;
for (Long l : deltime) {
|