On 1 April 2016 at 10:26,  <[email protected]> wrote:
> Author: pmouawad
> Date: Fri Apr  1 09:26:49 2016
> New Revision: 1737329
>
> URL: http://svn.apache.org/viewvc?rev=1737329&view=rev
> Log:
> As per sebb request on dev mailing list "ASCII art on JMeter startup", show 
> Ascii art only on:
> - help

OK, I agreed to that.

> - when error is made in command line

-1, that is not acceptable

There's already plenty of text for the user to have to read without
having to skip that as well.

> - -v

I think that's OK.

> Modified:
>     jmeter/trunk/res/META-INF/jmeter_as_ascii_art.txt
>     jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
>
> Modified: jmeter/trunk/res/META-INF/jmeter_as_ascii_art.txt
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/res/META-INF/jmeter_as_ascii_art.txt?rev=1737329&r1=1737328&r2=1737329&view=diff
> ==============================================================================
> --- jmeter/trunk/res/META-INF/jmeter_as_ascii_art.txt (original)
> +++ jmeter/trunk/res/META-INF/jmeter_as_ascii_art.txt Fri Apr  1 09:26:49 2016
> @@ -4,4 +4,4 @@
>   / ___ \|  __/ ___ \ |___|  _  | |___  | |_| | |  | | |___  | | | |___|  _ <
>  /_/   \_\_| /_/   \_\____|_| |_|_____|  \___/|_|  |_|_____| |_| |_____|_| 
> \_\ @VERSION@
>
> -Copyright 1999-@YEAR@ The Apache Software Foundation
> +Copyright (c) 1999-@YEAR@ The Apache Software Foundation
>
> Modified: jmeter/trunk/src/core/org/apache/jmeter/JMeter.java
> URL: 
> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/JMeter.java?rev=1737329&r1=1737328&r2=1737329&view=diff
> ==============================================================================
> --- jmeter/trunk/src/core/org/apache/jmeter/JMeter.java (original)
> +++ jmeter/trunk/src/core/org/apache/jmeter/JMeter.java Fri Apr  1 09:26:49 
> 2016
> @@ -362,14 +362,6 @@ public class JMeter implements JMeterPlu
>       * @param args The arguments for JMeter
>       */
>      public void start(String[] args) {
> -        try (InputStream inputStream = 
> JMeter.class.getResourceAsStream("jmeter_as_ascii_art.txt")) {
> -            if(inputStream != null) {
> -                String text = IOUtils.toString(inputStream);
> -                System.out.println(text);
> -            }
> -        } catch (IOException e1) {
> -            // NOP
> -        }
>          CLArgsParser parser = new CLArgsParser(args, options);
>          String error = parser.getErrorString();
>          if (error == null){// Check option combinations
> @@ -452,11 +444,12 @@ public class JMeter implements JMeterPlu
>              JMeterUtils.setProperty("START.HMS",new 
> SimpleDateFormat("HHmmss").format(today));// $NON-NLS-1$ $NON-NLS-2$
>
>              if (parser.getArgumentById(VERSION_OPT) != null) {
> -                System.out.println(JMeterUtils.getJMeterCopyright());
> -                System.out.println("Version " + 
> JMeterUtils.getJMeterVersion());
> +                displayAsciiArt();
>              } else if (parser.getArgumentById(HELP_OPT) != null) {
> +                displayAsciiArt();
>                  
> System.out.println(JMeterUtils.getResourceFileAsText("org/apache/jmeter/help.txt"));//
>  $NON-NLS-1$
>              } else if (parser.getArgumentById(OPTIONS_OPT) != null) {
> +                displayAsciiArt();
>                  
> System.out.println(CLUtil.describeOptions(options).toString());
>              } else if (parser.getArgumentById(SERVER_OPT) != null) {
>                  // Start the server
> @@ -518,8 +511,7 @@ public class JMeter implements JMeterPlu
>                  }
>              }
>          } catch (IllegalUserActionException e) {
> -            System.out.println(e.getMessage());
> -            System.out.println("Incorrect Usage");
> +            System.out.println("Incorrect Usage:"+e.getMessage());
>              System.out.println(CLUtil.describeOptions(options).toString());
>          } catch (Throwable e) {
>              log.fatalError("An error occurred: ",e);
> @@ -528,6 +520,21 @@ public class JMeter implements JMeterPlu
>          }
>      }
>
> +    /**
> +     * Displays as ASCII Art Apache JMeter version + Copyright notice
> +     */
> +    private void displayAsciiArt() {
> +        try (InputStream inputStream = 
> JMeter.class.getResourceAsStream("jmeter_as_ascii_art.txt")) {
> +            if(inputStream != null) {
> +                String text = IOUtils.toString(inputStream);
> +                System.out.println(text);
> +            }
> +        } catch (Exception e1) {
> +            System.out.println(JMeterUtils.getJMeterCopyright());
> +            System.out.println("Version " + JMeterUtils.getJMeterVersion());
> +        }
> +    }
> +
>      // Update classloader if necessary
>      private void updateClassLoader() {
>              updatePath("search_paths",";", true); //$NON-NLS-1$//$NON-NLS-2$
>
>

Reply via email to