diff --git a/cadc-util/build.gradle b/cadc-util/build.gradle index 3e6ea398..142dad3b 100644 --- a/cadc-util/build.gradle +++ b/cadc-util/build.gradle @@ -16,7 +16,7 @@ sourceCompatibility = 1.8 group = 'org.opencadc' -version = '1.11.3' +version = '1.11.4' description = 'OpenCADC core utility library' def git_url = 'https://github.com/opencadc/core' diff --git a/cadc-util/src/main/java/ca/nrc/cadc/db/version/KeyValueDAO.java b/cadc-util/src/main/java/ca/nrc/cadc/db/version/KeyValueDAO.java index 5af13967..675990fb 100644 --- a/cadc-util/src/main/java/ca/nrc/cadc/db/version/KeyValueDAO.java +++ b/cadc-util/src/main/java/ca/nrc/cadc/db/version/KeyValueDAO.java @@ -136,7 +136,7 @@ public KeyValue get(String name) { sel.setValues(name); try { o = jdbc.query(sel, extractor); - } catch (BadSqlGrammarException ex) { + } catch (Exception ex) { try { // try simples query possible to see if table exists String sql = "SELECT count(*) from " + tableName; @@ -153,6 +153,27 @@ public Integer mapRow(ResultSet rs, int i) throws SQLException { } catch (BadSqlGrammarException ex2) { log.debug("previous install not found: " + ex2.getMessage()); o = null; + } catch (Exception ex2) { + Throwable cause = ex2; + boolean notExists = false; + while (cause != null) { + if (cause instanceof SQLException) { + String msg = cause.getMessage(); + if (msg != null) { + msg = msg.trim().toLowerCase(); + if (msg.contains("does not exist")) { + log.debug("previous install not found: " + ex2.getMessage()); + o = null; + notExists = true; + } + } + } + cause = cause.getCause(); + } + if (!notExists) { + // some other kind of error + throw ex; + } } }