You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by po...@apache.org on 2004/12/08 11:00:29 UTC

cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/util CommandLineParser.java

polx        2004/12/08 02:00:29

  Modified:    jelly/src/java/org/apache/commons/jelly/util
                        CommandLineParser.java
  Log:
  Passing a property with "=" sign in the value was giving an "invalid" system
  property! Fixed.
  paul
  
  Revision  Changes    Path
  1.8       +5 -10     jakarta-commons/jelly/src/java/org/apache/commons/jelly/util/CommandLineParser.java
  
  Index: CommandLineParser.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/util/CommandLineParser.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- CommandLineParser.java	9 Sep 2004 15:10:05 -0000	1.7
  +++ CommandLineParser.java	8 Dec 2004 10:00:28 -0000	1.8
  @@ -146,15 +146,10 @@
               // -D args will not be copied into the filteredArgList.
               if (arg.startsWith("-D") && (arg.length() > 2)) {
                   arg = arg.substring(2);
  -                StringTokenizer toks = new StringTokenizer(arg, "=");
  -
  -                if (toks.countTokens() == 2) {
  -                    // add the tokens to the system properties
  -                    sysProps.setProperty(toks.nextToken(), toks.nextToken());
  -                } else {
  -                    System.err.println("Invalid system property: " + arg);
  -                }
  -
  +				int ePos = arg.indexOf("=");
  +				if(ePos==-1 || ePos==0 || ePos==arg.length()-1)
  +					System.err.println("Invalid system property: \"" + arg + "\".");
  +				sysProps.setProperty(arg.substring(0,ePos), arg.substring(ePos+1));
               } else {
                   // add this to the filtered list of arguments
                   filteredArgList.add(arg);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/util CommandLineParser.java

Posted by Paul Libbrecht <pa...@activemath.org>.
Le 10 déc. 04, à 04:27, Dion Gillard a écrit :
> And how about a simple test case for this? Is it possible?

Dreadfully sorry.
Sure, if we had a test-case for that (or... if checkstyle output was 
put in the console in the form of clickable warnings, that would be 
fine.

paul

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/util CommandLineParser.java

Posted by Dion Gillard <di...@gmail.com>.
More tabs?

And how about a simple test case for this? Is it possible?


On 8 Dec 2004 10:00:29 -0000, polx@apache.org <po...@apache.org> wrote:
> polx        2004/12/08 02:00:29
> 
>   Modified:    jelly/src/java/org/apache/commons/jelly/util
>                         CommandLineParser.java
>   Log:
>   Passing a property with "=" sign in the value was giving an "invalid" system
>   property! Fixed.
>   paul
> 
>   Revision  Changes    Path
>   1.8       +5 -10     jakarta-commons/jelly/src/java/org/apache/commons/jelly/util/CommandLineParser.java
> 
>   Index: CommandLineParser.java
>   ===================================================================
>   RCS file: /home/cvs/jakarta-commons/jelly/src/java/org/apache/commons/jelly/util/CommandLineParser.java,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- CommandLineParser.java    9 Sep 2004 15:10:05 -0000       1.7
>   +++ CommandLineParser.java    8 Dec 2004 10:00:28 -0000       1.8
>   @@ -146,15 +146,10 @@
>                // -D args will not be copied into the filteredArgList.
>                if (arg.startsWith("-D") && (arg.length() > 2)) {
>                    arg = arg.substring(2);
>   -                StringTokenizer toks = new StringTokenizer(arg, "=");
>   -
>   -                if (toks.countTokens() == 2) {
>   -                    // add the tokens to the system properties
>   -                    sysProps.setProperty(toks.nextToken(), toks.nextToken());
>   -                } else {
>   -                    System.err.println("Invalid system property: " + arg);
>   -                }
>   -
>   +                             int ePos = arg.indexOf("=");
>   +                             if(ePos==-1 || ePos==0 || ePos==arg.length()-1)
>   +                                     System.err.println("Invalid system property: \"" + arg + "\".");
>   +                             sysProps.setProperty(arg.substring(0,ePos), arg.substring(ePos+1));
>                } else {
>                    // add this to the filtered list of arguments
>                    filteredArgList.add(arg);
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org
> 
> 


-- 
http://www.multitask.com.au/people/dion/

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org