You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by sg...@apache.org on 2010/09/14 22:25:14 UTC
svn commit: r997078 - in /commons/proper/exec/trunk: NOTICE.txt
src/main/java/org/apache/commons/exec/util/StringUtils.java src/site/site.xml
Author: sgoeschl
Date: Tue Sep 14 20:25:14 2010
New Revision: 997078
URL: http://svn.apache.org/viewvc?rev=997078&view=rev
Log:
Updating documentation
Modified:
commons/proper/exec/trunk/NOTICE.txt
commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java
commons/proper/exec/trunk/src/site/site.xml
Modified: commons/proper/exec/trunk/NOTICE.txt
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/NOTICE.txt?rev=997078&r1=997077&r2=997078&view=diff
==============================================================================
--- commons/proper/exec/trunk/NOTICE.txt (original)
+++ commons/proper/exec/trunk/NOTICE.txt Tue Sep 14 20:25:14 2010
@@ -1,5 +1,5 @@
Apache Commons Exec
-Copyright 2005-2009 The Apache Software Foundation
+Copyright 2005-2010 The Apache Software Foundation
This product includes software developed by
The Apache Software Foundation (http://www.apache.org/).
Modified: commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java?rev=997078&r1=997077&r2=997078&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java (original)
+++ commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/util/StringUtils.java Tue Sep 14 20:25:14 2010
@@ -44,14 +44,24 @@ public class StringUtils {
private static final char BACKSLASH_CHAR = '\\';
/**
- * Perform a series of substitutions. The substitions
+ * Perform a series of substitutions. The substitutions
* are performed by replacing ${variable} in the target
* string with the value of provided by the key "variable"
- * in the provided hashtable.
+ * in the provided hash table.
+ * <p/><p/>
+ * A key consists of the following characters:
+ * <ul>
+ * <li>letter
+ * <li>digit
+ * <li>dot character
+ * <li>hyphen character
+ * <li>plus character
+ * <li>underscore character
+ * </ul>
*
* @param argStr the argument string to be processed
* @param vars name/value pairs used for substitution
- * @param isLenient ignore a key not found in vars?
+ * @param isLenient ignore a key not found in vars or throw a RuntimeException?
* @return String target string with replacements.
*/
public static StringBuffer stringSubstitution(String argStr, Map vars, boolean isLenient) {
@@ -89,7 +99,7 @@ public class StringUtils {
break;
}
- if (nameBuf.length() > 0) {
+ if (nameBuf.length() >= 0) {
String value;
Object temp = vars.get(nameBuf.toString());
@@ -123,7 +133,8 @@ public class StringUtils {
}
cIdx++;
- } else {
+ }
+ else {
argBuf.append(ch);
++cIdx;
}
@@ -179,7 +190,7 @@ public class StringUtils {
*
* @param strings the strings to concatenate
* @param separator the separator between two strings
- * @return the concatened strings
+ * @return the concatenated strings
*/
public static String toString(String[] strings, String separator) {
StringBuffer sb = new StringBuffer();
@@ -208,9 +219,11 @@ public class StringUtils {
String cleanedArgument = argument.trim();
+ // strip the quotes from both ends
while(cleanedArgument.startsWith(SINGLE_QUOTE) || cleanedArgument.startsWith(DOUBLE_QUOTE)) {
cleanedArgument = cleanedArgument.substring(1);
}
+
while(cleanedArgument.endsWith(SINGLE_QUOTE) || cleanedArgument.endsWith(DOUBLE_QUOTE)) {
cleanedArgument = cleanedArgument.substring(0, cleanedArgument.length() - 1);
}
@@ -234,14 +247,14 @@ public class StringUtils {
}
/**
- * Determines if this is a quoted argumented - either single or
+ * Determines if this is a quoted argument - either single or
* double quoted.
*
* @param argument the argument to check
* @return true when the argument is quoted
*/
public static boolean isQuoted(final String argument) {
- return ( argument.startsWith( SINGLE_QUOTE ) || argument.startsWith( DOUBLE_QUOTE ) ) &&
- ( argument.endsWith( SINGLE_QUOTE ) || argument.endsWith( DOUBLE_QUOTE ) );
+ return ( argument.startsWith( SINGLE_QUOTE ) && argument.endsWith( SINGLE_QUOTE ) ) ||
+ ( argument.startsWith( DOUBLE_QUOTE ) && argument.endsWith( DOUBLE_QUOTE ) );
}
}
\ No newline at end of file
Modified: commons/proper/exec/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/site/site.xml?rev=997078&r1=997077&r2=997078&view=diff
==============================================================================
--- commons/proper/exec/trunk/src/site/site.xml (original)
+++ commons/proper/exec/trunk/src/site/site.xml Tue Sep 14 20:25:14 2010
@@ -23,6 +23,7 @@
<menu name="Commons Exec">
<item name="Overview" href="/index.html" />
<item name="Tutorial" href="/tutorial.html" />
+ <item name="Command Line" href="/commandline.html" />
<item name="FAQ" href="faq.html"/>
<item name="Test Matrix" href="/testmatrix.html" />
<item name="Download" href="/download_exec.cgi"/>