diff options
Diffstat (limited to 'datarouter-prov/src/main/java')
5 files changed, 26 insertions, 7 deletions
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java index 2ea60d26..a021a60e 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/Group.java @@ -60,7 +60,7 @@ public class Group extends Syncable { public static Group getGroupMatching(Group gup) {
String sql = String.format(
- "select * from GROUPS where NAME = \"%s\"",
+ "select * from GROUPS where NAME='%s'",
gup.getName()
);
List<Group> list = getGroupsForSQL(sql);
@@ -69,7 +69,7 @@ public class Group extends Syncable { public static Group getGroupMatching(Group gup, int groupid) {
String sql = String.format(
- "select * from GROUPS where NAME = \"%s\" and GROUPID != %d ",
+ "select * from GROUPS where NAME = '%s' and GROUPID != %d ",
gup.getName(),
gup.getGroupid()
);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java index f3eb1eb6..1b368517 100755 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/NodeClass.java @@ -105,13 +105,14 @@ public abstract class NodeClass extends Syncable { public static void reload() {
Map<String, Integer> m = new HashMap<String, Integer>();
PreparedStatement ps = null;
+ ResultSet rs=null;
try {
DB db = new DB();
@SuppressWarnings("resource")
Connection conn = db.getConnection();
String sql = "select NODEID, NAME from NODES";
ps = conn.prepareStatement(sql);
- ResultSet rs = ps.executeQuery();
+ rs = ps.executeQuery();
while (rs.next()) {
int id = rs.getInt("NODEID");
String name = rs.getString("NAME");
@@ -127,6 +128,9 @@ public abstract class NodeClass extends Syncable { if(ps!=null){
ps.close();
}
+ if(rs!=null){
+ rs.close();
+ }
} catch (SQLException e) {
intLogger.error("PROV0005 doInsert: " + e.getMessage(),e);
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java index fe60f89f..98981a30 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubDelivery.java @@ -26,6 +26,7 @@ package org.onap.dmaap.datarouter.provisioning.beans; import java.sql.ResultSet;
import java.sql.SQLException;
+import java.util.Objects;
import org.json.JSONObject;
@@ -118,4 +119,9 @@ public class SubDelivery implements JSONable { return false;
return true;
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(url, user, password, use100);
+ }
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubLinks.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubLinks.java index f07a76e2..d3f82e6e 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubLinks.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/beans/SubLinks.java @@ -25,6 +25,7 @@ package org.onap.dmaap.datarouter.provisioning.beans;
import java.io.InvalidObjectException;
+import java.util.Objects;
import org.json.JSONObject;
@@ -102,4 +103,9 @@ public class SubLinks implements JSONable { return false;
return true;
}
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(self, feed, log);
+ }
}
diff --git a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java index bbcacb53..7f0d56b7 100644 --- a/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java +++ b/datarouter-prov/src/main/java/org/onap/dmaap/datarouter/provisioning/utils/DB.java @@ -112,13 +112,16 @@ public class DB { throw sqlEx;
}
}
+ finally {
+ if (connection != null && !connection.isValid(1)) {
+ connection.close();
+ connection = null;
+ }
+ }
} while (connection == null);
}
}
- if (connection != null && !connection.isValid(1)) {
- connection.close();
- connection = null;
- }
+
}
return connection;
}
|