1616package org .utplsql .sqldev .oddgen ;
1717
1818import java .sql .Connection ;
19- import java .sql .SQLException ;
2019import java .util .ArrayList ;
2120import java .util .Arrays ;
2221import java .util .HashMap ;
2322import java .util .HashSet ;
2423import java .util .LinkedHashMap ;
2524import java .util .List ;
26- import java .util .logging .Logger ;
2725import java .util .stream .Collectors ;
2826
2927import org .oddgen .sqldev .generators .OddgenGenerator2 ;
3028import org .oddgen .sqldev .generators .model .Node ;
3129import org .utplsql .sqldev .dal .UtplsqlDao ;
32- import org .utplsql .sqldev .exception . GenericDatabaseAccessException ;
30+ import org .utplsql .sqldev .model . DatabaseTools ;
3331import org .utplsql .sqldev .model .StringTools ;
3432import org .utplsql .sqldev .model .preference .PreferenceModel ;
3533import org .utplsql .sqldev .resources .UtplsqlResources ;
3634
3735import oracle .ide .config .Preferences ;
3836
3937public class RunGenerator implements OddgenGenerator2 {
40- private static final Logger logger = Logger .getLogger (RunGenerator .class .getName ());
41-
4238 public static final String YES = "Yes" ;
4339 public static final String NO = "No" ;
4440 public static final String RESET_PACKAGE = UtplsqlResources .getString ("PREF_RESET_PACKAGE_LABEL" );
@@ -50,20 +46,7 @@ public class RunGenerator implements OddgenGenerator2 {
5046
5147 @ Override
5248 public boolean isSupported (final Connection conn ) {
53- try {
54- boolean ret = false ;
55- if (conn != null && conn .getMetaData ().getDatabaseProductName ().startsWith ("Oracle" )
56- && (conn .getMetaData ().getDatabaseMajorVersion () == 11
57- && conn .getMetaData ().getDatabaseMinorVersion () >= 2
58- || conn .getMetaData ().getDatabaseMajorVersion () > 11 )) {
59- ret = true ;
60- }
61- return ret ;
62- } catch (SQLException e ) {
63- final String msg = "SQLException during connection check due to " + e .getMessage ();
64- logger .severe (() -> msg );
65- throw new GenericDatabaseAccessException (msg , e );
66- }
49+ return DatabaseTools .isSupported (conn );
6750 }
6851
6952 @ Override
@@ -129,13 +112,7 @@ public HashMap<String, Boolean> getParamStates(final Connection conn, final Link
129112
130113 private String getPath (final Node node , final Connection conn ) {
131114 if ("SUITE" .equals (node .getId ()) || "SUITEPATH" .equals (node .getId ())) {
132- try {
133- return conn .getMetaData ().getUserName ();
134- } catch (SQLException e ) {
135- final String msg = "SQLException during getUserName() due to " + e .getMessage ();
136- logger .severe (() -> msg );
137- throw new GenericDatabaseAccessException (msg , e );
138- }
115+ return DatabaseTools .getUser (conn );
139116 } else {
140117 return node .getId ();
141118 }
0 commit comments