File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
httpcore5-testing/src/main/java/org/apache/hc/core5/benchmark Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change 2727package org .apache .hc .core5 .benchmark ;
2828
2929import java .io .File ;
30+ import java .io .IOException ;
3031import java .net .URI ;
3132import java .net .URISyntaxException ;
3233
3334import org .apache .commons .cli .CommandLine ;
34- import org .apache .commons .cli .HelpFormatter ;
3535import org .apache .commons .cli .Option ;
3636import org .apache .commons .cli .Options ;
37+ import org .apache .commons .cli .help .HelpFormatter ;
3738import org .apache .hc .core5 .http .ContentType ;
3839import org .apache .hc .core5 .http .Method ;
3940import org .apache .hc .core5 .util .TimeValue ;
@@ -246,14 +247,23 @@ public static BenchmarkConfig parseCommandLine(final CommandLine cmd) {
246247 return builder .build ();
247248 }
248249
249- static void showUsage (final Options options ) {
250- final HelpFormatter formatter = new HelpFormatter ();
251- formatter .printHelp ("HttpBenchmark [options] [http://]hostname[:port]/path?query" , options );
250+ static void showUsage (final Options options ) throws IOException {
251+ final HelpFormatter formatter = HelpFormatter .builder ().get ();
252+ formatter .printHelp (
253+ "HttpBenchmark [http://]hostname[:port]/path?query" ,
254+ null ,
255+ options ,
256+ null ,
257+ true );
252258 }
253259
254260 static void printError (final String msg ) {
255261 System .err .println (msg );
256- showUsage (getOptions ());
262+ try {
263+ showUsage (getOptions ());
264+ } catch (final IOException ex ) {
265+ System .err .println (ex .getMessage ());
266+ }
257267 System .exit (-1 );
258268 }
259269}
You can’t perform that action at this time.
0 commit comments