22
33import com .beust .jcommander .Parameter ;
44import com .beust .jcommander .Parameters ;
5+ import org .utplsql .api .exception .DatabaseNotCompatibleException ;
6+ import org .utplsql .api .exception .UtPLSQLNotInstalledException ;
57import org .utplsql .api .reporter .ReporterFactory ;
68import org .utplsql .api .reporter .inspect .ReporterInfo ;
79import org .utplsql .api .reporter .inspect .ReporterInspector ;
10+ import org .utplsql .cli .exception .DatabaseConnectionFailed ;
811
912import javax .sql .DataSource ;
1013import java .io .PrintStream ;
@@ -21,9 +24,11 @@ public class ReportersCommand implements ICommand {
2124 private List <ConnectionInfo > connectionInfoList = new ArrayList <>();
2225
2326 private ConnectionInfo getConnectionInfo () {
24- assert connectionInfoList != null ;
25- assert connectionInfoList .size () > 0 ;
26- assert connectionInfoList .get (0 ) != null ;
27+ Objects .requireNonNull (connectionInfoList );
28+
29+ if ( connectionInfoList .size () <= 0
30+ || connectionInfoList .get (0 ) == null )
31+ throw new IllegalArgumentException ("No Connection-Info given" );
2732
2833 return connectionInfoList .get (0 );
2934 }
@@ -39,7 +44,11 @@ public int run() {
3944
4045 writeReporters (ReporterInspector .create (reporterFactory , con ).getReporterInfos (), System .out );
4146 }
42- } catch (Exception e ) {
47+ }
48+ catch ( DatabaseNotCompatibleException | UtPLSQLNotInstalledException | DatabaseConnectionFailed | IllegalArgumentException e ) {
49+ System .out .println (e .getMessage ());
50+ }
51+ catch (Exception e ) {
4352 e .printStackTrace ();
4453 return 1 ;
4554 }
0 commit comments