@@ -144,30 +144,35 @@ private void fillDefaultProbeLists() {
144
144
}
145
145
146
146
public SiteReport scan () {
147
- if ( isConnectable ()) {
148
- LOGGER . debug ( config . getClientDelegate (). getHost () + " is connectable" );
149
- if (speaksTls ()) {
147
+ boolean isConnectable = false ;
148
+ try {
149
+ if (isConnectable ()) {
150
150
LOGGER .debug (config .getClientDelegate ().getHost () + " is connectable" );
151
- ScanJob job = new ScanJob (phaseOneTestList , phaseTwoTestList , afterList );
152
- SiteReport report = executor .execute (config , job );
153
- if (closeAfterFinish ) {
154
- executor .shutdown ();
151
+ if (speaksTls ()) {
152
+ LOGGER .debug (config .getClientDelegate ().getHost () + " is connectable" );
153
+ ScanJob job = new ScanJob (phaseOneTestList , phaseTwoTestList , afterList );
154
+ SiteReport report = executor .execute (config , job );
155
+ return report ;
156
+ } else {
157
+ isConnectable = true ;
155
158
}
156
- if (closeAfterFinishParallel ) {
157
- parallelExecutor .shutdown ();
158
- }
159
- return report ;
160
159
}
160
+ SiteReport report = new SiteReport (config .getClientDelegate ().getHost (), new LinkedList <ProbeType >(), config .isNoColor ());
161
+ report .setServerIsAlive (isConnectable );
162
+ report .setSupportsSslTls (false );
163
+ return report ;
164
+ } finally {
165
+ closeExecutorsIfNeeded ();
161
166
}
162
- SiteReport report = new SiteReport (config .getClientDelegate ().getHost (), new LinkedList <ProbeType >(), config .isNoColor ());
163
- report .setServerIsAlive (false );
167
+ }
168
+
169
+ private void closeExecutorsIfNeeded () {
164
170
if (closeAfterFinish ) {
165
171
executor .shutdown ();
166
172
}
167
173
if (closeAfterFinishParallel ) {
168
174
parallelExecutor .shutdown ();
169
175
}
170
- return report ;
171
176
}
172
177
173
178
public boolean isConnectable () {
0 commit comments