Author: rob.stryker(a)jboss.com
Date: 2009-04-13 04:50:03 -0400 (Mon, 13 Apr 2009)
New Revision: 14704
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ArgsUtil.java
Log:
JBIDE-4026 - found a bug in ArgsUtil while investigating. setArg didn't work if the
arg wasn't present yet. Weird.
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ArgsUtil.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ArgsUtil.java 2009-04-13
08:45:19 UTC (rev 14703)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ArgsUtil.java 2009-04-13
08:50:03 UTC (rev 14704)
@@ -118,21 +118,26 @@
public static String setArg(String allArgs, String shortOpt, String longOpt, String
value, boolean addQuotes ) {
if( addQuotes )
value = "\"" + value + "\"";
+ boolean found = false;
String[] args = parse(allArgs);
String retVal = "";
for( int i = 0; i < args.length; i++ ) {
if( args[i].equals(shortOpt)) {
args[i+1] = value;
retVal += args[i] + " " + args[++i] + " ";
+ found = true;
} else if( longOpt != null && args[i].startsWith(longOpt + "=")) {
args[i] = longOpt + "=" + value;
retVal += args[i] + " ";
+ found = true;
} else {
retVal += args[i] + " ";
}
}
// turn this to a retval;
+ if( !found )
+ retVal = retVal + longOpt + "=" + value;
return retVal;
}