Skip to content

Commit 4b2e3ac

Browse files
getUtPlsqlVersion does not fail when utplsql is not installed
returns a version null in this case, which is later converted to 0.0.0, which is not a supported version for this extension and not a supported version for the realtime reporter, hence calling the runner leads to a use of the worksheet runner regardless of the utPLSQL configuration.
1 parent cc76849 commit 4b2e3ac

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

sqldev/src/main/java/org/utplsql/sqldev/dal/UtplsqlDao.xtend

+22-14
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import org.utplsql.sqldev.model.ut.OutputLines
3333

3434
class UtplsqlDao {
3535
public static val UTPLSQL_PACKAGE_NAME = "UT"
36+
public static val NOT_INSTALLED = 0000000
3637
public static val FIRST_VERSION_WITH_INTERNAL_ANNOTATION_API = 3000004
3738
public static val FIRST_VERSION_WITH_ANNOTATION_API = 3001003
3839
public static val FIRST_VERSION_WITHOUT_INTERNAL_API = 3001008
@@ -60,14 +61,15 @@ class UtplsqlDao {
6061
* returns a normalized utPLSQL version in format 9.9.9
6162
*/
6263
def String normalizedUtPlsqlVersion() {
63-
val p = Pattern.compile("(\\d+\\.\\d+\\.\\d+)")
6464
val version = getUtPlsqlVersion()
65-
val m = p.matcher(version)
66-
if (m.find) {
67-
return m.group(0)
68-
} else {
69-
return "0.0.0"
65+
if (version !== null) {
66+
val p = Pattern.compile("(\\d+\\.\\d+\\.\\d+)")
67+
val m = p.matcher(version)
68+
if (m.find) {
69+
return m.group(0)
70+
}
7071
}
72+
return "0.0.0"
7173
}
7274

7375
/**
@@ -97,14 +99,20 @@ class UtplsqlDao {
9799
? := ut.version;
98100
END;
99101
'''
100-
cachedUtPlsqlVersion = jdbcTemplate.execute(sql, new CallableStatementCallback<String>() {
101-
override String doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
102-
cs.registerOutParameter(1, Types.VARCHAR);
103-
cs.execute
104-
val version = cs.getString(1)
105-
return version
106-
}
107-
})
102+
try {
103+
cachedUtPlsqlVersion = jdbcTemplate.execute(sql, new CallableStatementCallback<String>() {
104+
override String doInCallableStatement(CallableStatement cs) throws SQLException, DataAccessException {
105+
cs.registerOutParameter(1, Types.VARCHAR);
106+
cs.execute
107+
val version = cs.getString(1)
108+
return version
109+
}
110+
})
111+
} catch (SQLException e) {
112+
// ignore error
113+
} catch (DataAccessException e) {
114+
// ignore error
115+
}
108116
}
109117
return cachedUtPlsqlVersion
110118
}

0 commit comments

Comments
 (0)