commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p...@apache.org
Subject cvs commit: jakarta-commons/jelly/src/java/org/apache/commons/jelly/util CommandLineParser.java
Date Wed, 08 Dec 2004 10:00:29 GMT
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


Mime
View raw message