modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java | 7 ++++++- modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-)
New commits: commit e6e41cf77ad3cd48cb50abb74b56952c289fa49c Author: Lukas Krejci lkrejci@redhat.com Date: Tue Aug 10 17:57:09 2010 +0200
Unnecessarily getting a value twice.
diff --git a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java index af3280a..6312c4d 100644 --- a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java +++ b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresUserComponent.java @@ -151,7 +151,8 @@ public class PostgresUserComponent implements DatabaseComponent<PostgresServerCo + " ";
if (type != UpdateType.DROP) { - if (config.getSimpleValue("password",null) != null && config.getSimpleValue("password",null).length() != 0) { + String password = config.getSimpleValue("password",null); + if (password != null && password.length() != 0) { sql += " WITH PASSWORD '" + config.getSimpleValue("password",null) + "' "; }
commit 75e16e1459f6e2d7f1725189be63f2439a91ec3a Author: Lukas Krejci lkrejci@redhat.com Date: Tue Aug 10 17:56:14 2010 +0200
Make sure to close the JDBC connection.
diff --git a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java index b02d764..b03327d 100644 --- a/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java +++ b/modules/plugins/postgres/src/main/java/org/rhq/plugins/postgres/PostgresDiscoveryComponent.java @@ -298,7 +298,12 @@ public class PostgresDiscoveryComponent implements ResourceDiscoveryComponent, M }
public static List<String> getDatabases(Configuration pluginConfiguration) { - return getDatabaseNames(pluginConfiguration, getConnection(pluginConfiguration)); + Connection conn = getConnection(pluginConfiguration); + try { + return getDatabaseNames(pluginConfiguration, conn); + } finally { + JDBCUtil.safeClose(conn); + } }
private static List<String> getDatabaseNames(Configuration config, Connection conn) {
rhq-commits@lists.fedorahosted.org