@@ -28,7 +28,7 @@ public TestRunner addPath(String path) {
28
28
}
29
29
30
30
public TestRunner addPathList (List <String > paths ) {
31
- this .pathList .addAll (paths );
31
+ if ( pathList != null ) this .pathList .addAll (paths );
32
32
return this ;
33
33
}
34
34
@@ -43,7 +43,7 @@ public TestRunner colorConsole(boolean colorConsole) {
43
43
}
44
44
45
45
public TestRunner addReporterList (List <Reporter > reporterList ) {
46
- this .reporterList .addAll (reporterList );
46
+ if ( reporterList != null ) this .reporterList .addAll (reporterList );
47
47
return this ;
48
48
}
49
49
@@ -53,12 +53,12 @@ public TestRunner addCoverageScheme(String coverageScheme) {
53
53
}
54
54
55
55
public TestRunner withSourceFiles (List <String > sourceFiles ) {
56
- this .sourceFiles .addAll (sourceFiles );
56
+ if ( sourceFiles != null ) this .sourceFiles .addAll (sourceFiles );
57
57
return this ;
58
58
}
59
59
60
60
public TestRunner withTestFiles (List <String > testFiles ) {
61
- this .testFiles .addAll (testFiles );
61
+ if ( testFiles != null ) this .testFiles .addAll (testFiles );
62
62
return this ;
63
63
}
64
64
@@ -84,34 +84,63 @@ public void run(Connection conn) throws SQLException {
84
84
this .reporterList .add (new DocumentationReporter ().init (conn ));
85
85
}
86
86
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
-
96
87
// Workaround because Oracle JDBC doesn't support passing boolean to stored procedures.
97
88
String colorConsoleStr = Boolean .toString (this .colorConsole );
98
89
90
+ OracleConnection oraConn = conn .unwrap (OracleConnection .class );
99
91
CallableStatement callableStatement = null ;
100
92
try {
101
93
callableStatement = conn .prepareCall (
102
94
"BEGIN " +
103
- "ut_runner.run(" +
95
+ "ut_runner.run(" +
104
96
"a_paths => ?, a_reporters => ?, a_color_console => " + colorConsoleStr + ", " +
105
97
"a_coverage_schemes => ?, a_source_files => ?, a_test_files => ?, " +
106
98
"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
+
115
144
callableStatement .execute ();
116
145
} finally {
117
146
if (callableStatement != null )
0 commit comments