aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing-drivers/src/org/aspectj/testing/drivers/Harness.java24
-rw-r--r--util/src/org/aspectj/util/LangUtil.java41
2 files changed, 58 insertions, 7 deletions
diff --git a/testing-drivers/src/org/aspectj/testing/drivers/Harness.java b/testing-drivers/src/org/aspectj/testing/drivers/Harness.java
index efa070d78..8c35d29ab 100644
--- a/testing-drivers/src/org/aspectj/testing/drivers/Harness.java
+++ b/testing-drivers/src/org/aspectj/testing/drivers/Harness.java
@@ -83,6 +83,7 @@ public class Harness {
* including the two-space leader
*/
protected static final String SYNTAX_PAD = " ";
+ protected static final String OPTION_DELIM = ";";
private static final String JAVA_VERSION;
private static final String ASPECTJ_VERSION;
static {
@@ -378,7 +379,7 @@ public class Harness {
if (null != aliases) {
String args = aliases.getProperty(option);
if (!LangUtil.isEmpty(args)) {
- return LangUtil.commaSplit(args);
+ return LangUtil.anySplit(args, OPTION_DELIM);
}
}
return null;
@@ -542,10 +543,23 @@ public class Harness {
class FeatureHarness extends Harness {
private static final String[] ALIASES = new String[]
- { "-hideStreams", "-hideCompilerStreams,-hideRunStreams",
- "-jim", "!eclipse,-logMinFail,-hideStreams",
- "-loud", "-verboseHarness",
- "-baseline", "-verboseHarness,-traceTestsMin,-hideStreams,!eclipse"
+ { "-hideStreams",
+ "-hideCompilerStreams"
+ + OPTION_DELIM + "-hideRunStreams",
+ "-jim",
+ "!eclipse"
+ + OPTION_DELIM + "-logMinFail"
+ + OPTION_DELIM + "-hideStreams",
+ "-loud",
+ "-verboseHarness",
+ "-baseline",
+ "-verboseHarness"
+ + OPTION_DELIM + "-traceTestsMin"
+ + OPTION_DELIM + "-hideStreams"
+ + OPTION_DELIM + "!eclipse",
+ "-release",
+ "-baseline"
+ + OPTION_DELIM + "-ajctestSkipKeywords=knownLimitations,purejava"
};
static {
Properties optionAliases = Harness.getOptionAliases();
diff --git a/util/src/org/aspectj/util/LangUtil.java b/util/src/org/aspectj/util/LangUtil.java
index 0a93721f1..3dc5a2f9d 100644
--- a/util/src/org/aspectj/util/LangUtil.java
+++ b/util/src/org/aspectj/util/LangUtil.java
@@ -169,15 +169,32 @@ public class LangUtil {
* @return List of String of elements.
*/
public static List commaSplit(String input) {
+ return anySplit(input, ",");
+ }
+
+ /**
+ * Splits <code>input</code>, removing delimiter and
+ * trimming any white space.
+ * Returns an empty collection if the input is null.
+ * If delimiter is null or empty or if the input contains
+ * no delimiters, the input itself is returned
+ * after trimming white space.
+ *
+ * @param text <code>String</code> to split.
+ * @param delimiter <code>String</code> separators for input.
+ * @return List of String of elements.
+ */
+ public static List anySplit(String input, String delim) {
if (null == input) {
return Collections.EMPTY_LIST;
}
ArrayList result = new ArrayList();
- if (-1 == input.indexOf(",")) {
+ if (LangUtil.isEmpty(delim)
+ || (-1 == input.indexOf(delim))) {
result.add(input.trim());
} else {
- StringTokenizer st = new StringTokenizer(input, ",");
+ StringTokenizer st = new StringTokenizer(input, delim);
while (st.hasMoreTokens()) {
result.add(st.nextToken().trim());
}
@@ -568,6 +585,26 @@ public class LangUtil {
return LangUtil.unqualifiedClassName(null == o ? null : o.getClass());
}
+ /** inefficient way to replace all instances of sought with replace */
+ public static String replace(String in, String sought, String replace) {
+ if (LangUtil.isEmpty(in) || LangUtil.isEmpty(sought)) {
+ return in;
+ }
+ StringBuffer result = new StringBuffer();
+ final int len = sought.length();
+ int start = 0;
+ int loc;
+ while (-1 != (loc = in.indexOf(sought, start))) {
+ result.append(in.substring(start, loc));
+ if (!LangUtil.isEmpty(replace)) {
+ result.append(in.substring(start, loc));
+ }
+ start = loc + len;
+ }
+ result.append(in.substring(start));
+ return result.toString();
+ }
+
/** render i right-justified with a given width less than about 40 */
public static String toSizedString(long i, int width) {
String result = "" + i;