Update of /cvsroot/monetdb/clients/src/java/src/nl/cwi/monetdb/jdbc
In directory
sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14028/src/nl/cwi/monetdb/jdbc
Modified Files:
MonetDatabaseMetaData.java
Log Message:
Don't crash when environment variables cannot be found.
Index: MonetDatabaseMetaData.java
===================================================================
RCS file:
/cvsroot/monetdb/clients/src/java/src/nl/cwi/monetdb/jdbc/MonetDatabaseMetaData.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- MonetDatabaseMetaData.java 20 Jul 2007 12:08:22 -0000 1.6
+++ MonetDatabaseMetaData.java 3 Sep 2007 11:27:09 -0000 1.7
@@ -52,7 +52,7 @@
* server. To avoid querying the server over and over again, once a
* value is read, it is kept in a Map for reuse.
*/
- private synchronized String getEnv(String key) throws SQLException {
+ private synchronized String getEnv(String key) {
String ret;
// if due to concurrency on this Class envs is assigned twice, I
@@ -61,12 +61,16 @@
if (menvs == null) {
// make the env map, insert all entries from env()
menvs = new HashMap();
- ResultSet env = getStmt().executeQuery(
- "SELECT \"name\", \"value\" FROM
sys.env() as env");
- while (env.next()) {
- menvs.put(env.getString("name"),
env.getString("value"));
+ try {
+ ResultSet env = getStmt().executeQuery(
+ "SELECT \"name\", \"value\"
FROM sys.env() as env");
+ while (env.next()) {
+ menvs.put(env.getString("name"),
env.getString("value"));
+ }
+ env.close();
+ } catch (SQLException e) {
+ // ignore
}
- env.close();
envs.put(con, menvs);
}
if ((ret = (String)(menvs.get(key))) == null) {
@@ -77,13 +81,17 @@
// it's only used inside this class.
// The effects of caching a variable, might be
// undesirable... TODO
- ResultSet env = getStmt().executeQuery(
- "SELECT @\"" + key + "\" AS \"value\"");
- if (env.next()) {
- ret = env.getString("value");
- menvs.put(key, ret);
+ try {
+ ResultSet env = getStmt().executeQuery(
+ "SELECT @\"" + key + "\" AS
\"value\"");
+ if (env.next()) {
+ ret = env.getString("value");
+ menvs.put(key, ret);
+ }
+ env.close();
+ } catch (SQLException e) {
+ // ignore
}
- env.close();
}
return(ret);
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Monetdb-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-checkins