@@ -28,7 +28,7 @@ public TestRunner addPath(String path) {
2828 }
2929
3030 public TestRunner addPathList (List <String > paths ) {
31- this .pathList .addAll (paths );
31+ if ( pathList != null ) this .pathList .addAll (paths );
3232 return this ;
3333 }
3434
@@ -43,7 +43,7 @@ public TestRunner colorConsole(boolean colorConsole) {
4343 }
4444
4545 public TestRunner addReporterList (List <Reporter > reporterList ) {
46- this .reporterList .addAll (reporterList );
46+ if ( reporterList != null ) this .reporterList .addAll (reporterList );
4747 return this ;
4848 }
4949
@@ -53,12 +53,12 @@ public TestRunner addCoverageScheme(String coverageScheme) {
5353 }
5454
5555 public TestRunner withSourceFiles (List <String > sourceFiles ) {
56- this .sourceFiles .addAll (sourceFiles );
56+ if ( sourceFiles != null ) this .sourceFiles .addAll (sourceFiles );
5757 return this ;
5858 }
5959
6060 public TestRunner withTestFiles (List <String > testFiles ) {
61- this .testFiles .addAll (testFiles );
61+ if ( testFiles != null ) this .testFiles .addAll (testFiles );
6262 return this ;
6363 }
6464
@@ -84,34 +84,63 @@ public void run(Connection conn) throws SQLException {
8484 this .reporterList .add (new DocumentationReporter ().init (conn ));
8585 }
8686
87- OracleConnection oraConn = conn .unwrap (OracleConnection .class );
88- Array pathArray = oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .pathList .toArray ());
89- Array reporterArray = oraConn .createARRAY (CustomTypes .UT_REPORTERS , this .reporterList .toArray ());
90- Array coverageSchemesArray = oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .coverageSchemes .toArray ());
91- Array sourceFilesArray = oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .sourceFiles .toArray ());
92- Array testFilesArray = oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .testFiles .toArray ());
93- Array includeObjectsArray = oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .includeObjects .toArray ());
94- Array excludeObjectsArray = oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .excludeObjects .toArray ());
95-
9687 // Workaround because Oracle JDBC doesn't support passing boolean to stored procedures.
9788 String colorConsoleStr = Boolean .toString (this .colorConsole );
9889
90+ OracleConnection oraConn = conn .unwrap (OracleConnection .class );
9991 CallableStatement callableStatement = null ;
10092 try {
10193 callableStatement = conn .prepareCall (
10294 "BEGIN " +
103- "ut_runner.run(" +
95+ "ut_runner.run(" +
10496 "a_paths => ?, a_reporters => ?, a_color_console => " + colorConsoleStr + ", " +
10597 "a_coverage_schemes => ?, a_source_files => ?, a_test_files => ?, " +
10698 "a_include_objects => ?, a_exclude_objects => ?); " +
107- "END;" );
108- callableStatement .setArray (1 , pathArray );
109- callableStatement .setArray (2 , reporterArray );
110- callableStatement .setArray (3 , coverageSchemesArray );
111- callableStatement .setArray (4 , sourceFilesArray );
112- callableStatement .setArray (5 , testFilesArray );
113- callableStatement .setArray (6 , includeObjectsArray );
114- callableStatement .setArray (7 , excludeObjectsArray );
99+ "END;" );
100+
101+ int paramIdx = 0 ;
102+
103+ callableStatement .setArray (
104+ ++paramIdx , oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .pathList .toArray ()));
105+
106+ callableStatement .setArray (
107+ ++paramIdx , oraConn .createARRAY (CustomTypes .UT_REPORTERS , this .reporterList .toArray ()));
108+
109+ if (this .coverageSchemes .isEmpty ()) {
110+ callableStatement .setNull (++paramIdx , Types .ARRAY , CustomTypes .UT_VARCHAR2_LIST );
111+ } else {
112+ callableStatement .setArray (
113+ ++paramIdx , oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .coverageSchemes .toArray ()));
114+ }
115+
116+ if (this .sourceFiles .isEmpty ()) {
117+ callableStatement .setNull (++paramIdx , Types .ARRAY , CustomTypes .UT_VARCHAR2_LIST );
118+ } else {
119+ callableStatement .setArray (
120+ ++paramIdx , oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .sourceFiles .toArray ()));
121+ }
122+
123+ if (this .testFiles .isEmpty ()) {
124+ callableStatement .setNull (++paramIdx , Types .ARRAY , CustomTypes .UT_VARCHAR2_LIST );
125+ } else {
126+ callableStatement .setArray (
127+ ++paramIdx , oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .testFiles .toArray ()));
128+ }
129+
130+ if (this .includeObjects .isEmpty ()) {
131+ callableStatement .setNull (++paramIdx , Types .ARRAY , CustomTypes .UT_VARCHAR2_LIST );
132+ } else {
133+ callableStatement .setArray (
134+ ++paramIdx , oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .includeObjects .toArray ()));
135+ }
136+
137+ if (this .excludeObjects .isEmpty ()) {
138+ callableStatement .setNull (++paramIdx , Types .ARRAY , CustomTypes .UT_VARCHAR2_LIST );
139+ } else {
140+ callableStatement .setArray (
141+ ++paramIdx , oraConn .createARRAY (CustomTypes .UT_VARCHAR2_LIST , this .excludeObjects .toArray ()));
142+ }
143+
115144 callableStatement .execute ();
116145 } finally {
117146 if (callableStatement != null )
0 commit comments