File tree Expand file tree Collapse file tree 2 files changed +19
-12
lines changed
src/main/java/org/utplsql/cli Expand file tree Collapse file tree 2 files changed +19
-12
lines changed Original file line number Diff line number Diff line change @@ -20,11 +20,12 @@ public class ReportersCommand implements ICommand {
2020 description = ConnectionInfo .COMMANDLINE_PARAM_DESCRIPTION )
2121 private List <ConnectionInfo > connectionInfoList = new ArrayList <>();
2222
23- public ConnectionInfo getConnectionInfo () {
24- if ( connectionInfoList != null && connectionInfoList .size () > 0 )
25- return connectionInfoList .get (0 );
26- else
27- return null ;
23+ private ConnectionInfo getConnectionInfo () {
24+ assert connectionInfoList != null ;
25+ assert connectionInfoList .size () > 0 ;
26+ assert connectionInfoList .get (0 ) != null ;
27+
28+ return connectionInfoList .get (0 );
2829 }
2930
3031 @ Override
Original file line number Diff line number Diff line change 1010
1111import javax .sql .DataSource ;
1212import java .sql .Connection ;
13+ import java .sql .SQLException ;
1314import java .util .ArrayList ;
1415import java .util .List ;
1516
@@ -34,7 +35,18 @@ public int run() {
3435 System .out .println (CliVersionInfo .getInfo ());
3536 System .out .println (JavaApiVersionInfo .getInfo ());
3637
37- ConnectionInfo ci = getConnectionInfo ();
38+ try {
39+ writeUtPlsqlVersion (getConnectionInfo ());
40+ }
41+ catch (SQLException e ) {
42+ e .printStackTrace ();
43+ return 1 ;
44+ }
45+
46+ return 0 ;
47+ }
48+
49+ private void writeUtPlsqlVersion ( ConnectionInfo ci ) throws SQLException {
3850 if ( ci != null ) {
3951
4052 DataSource dataSource = DataSourceProvider .getDataSource (ci , 1 );
@@ -46,13 +58,7 @@ public int run() {
4658 catch ( UtPLSQLNotInstalledException e ) {
4759 System .out .println ("utPLSQL framework is not installed in database." );
4860 }
49- catch ( Exception e ) {
50- e .printStackTrace ();
51- return 1 ;
52- }
5361 }
54-
55- return 0 ;
5662 }
5763
5864 @ Override
You can’t perform that action at this time.
0 commit comments