23
23
import java .util .concurrent .Executors ;
24
24
import java .util .concurrent .Future ;
25
25
import me .tongfei .progressbar .ProgressBar ;
26
- import me .tongfei .progressbar .ProgressBarBuilder ;
27
- import me .tongfei .progressbar .ProgressBarStyle ;
28
26
import org .apache .logging .log4j .LogManager ;
29
27
import org .apache .logging .log4j .Logger ;
30
28
@@ -47,8 +45,8 @@ public MultiThreadedScanJobExecutor(ExecutorService executor) {
47
45
}
48
46
49
47
public SiteReport execute (ScannerConfig config , ScanJob scanJob ) {
50
-
51
- if (config .getGeneralDelegate ().isDebug ()) {
48
+
49
+ if (config .getGeneralDelegate ().isDebug () || config . isNoProgressbar ()) {
52
50
return scan (config , scanJob , null );
53
51
} else {
54
52
int numberOfProbes = 0 ;
@@ -67,10 +65,10 @@ public SiteReport execute(ScannerConfig config, ScanJob scanJob) {
67
65
}
68
66
}
69
67
}
70
-
68
+
71
69
private SiteReport scan (ScannerConfig config , ScanJob scanJob , ProgressBar pb ) {
72
70
List <ProbeType > probeTypes = new LinkedList <>();
73
- if (pb != null ){
71
+ if (pb != null ) {
74
72
pb .setExtraMessage ("Executing Probes" );
75
73
}
76
74
List <Future <ProbeResult >> futureResults = new LinkedList <>();
@@ -118,7 +116,7 @@ private SiteReport scan(ScannerConfig config, ScanJob scanJob, ProgressBar pb) {
118
116
ProbeResult result = probe .getNotExecutedResult ();
119
117
if (result != null ) {
120
118
resultList .add (result );
121
- if (pb != null ){
119
+ if (pb != null ) {
122
120
pb .step ();
123
121
}
124
122
}
@@ -149,8 +147,8 @@ private SiteReport scan(ScannerConfig config, ScanJob scanJob, ProgressBar pb) {
149
147
LOGGER .info ("Finished scan for: " + hostname );
150
148
return report ;
151
149
}
152
-
153
- private void checkProbesDone (List <Future <ProbeResult >> futureResults , ProgressBar pb ){
150
+
151
+ private void checkProbesDone (List <Future <ProbeResult >> futureResults , ProgressBar pb ) {
154
152
boolean isNotReady = true ;
155
153
int done = 0 ;
156
154
int tempDone = 0 ;
@@ -161,7 +159,7 @@ private void checkProbesDone(List<Future<ProbeResult>> futureResults, ProgressBa
161
159
tempDone ++;
162
160
}
163
161
if (done < tempDone ) {
164
- if (pb != null ){
162
+ if (pb != null ) {
165
163
pb .step ();
166
164
}
167
165
done = tempDone ;
@@ -171,7 +169,7 @@ private void checkProbesDone(List<Future<ProbeResult>> futureResults, ProgressBa
171
169
}
172
170
}
173
171
}
174
- }
172
+ }
175
173
176
174
@ Override
177
175
public void shutdown () {
0 commit comments