String.split() behaves differently in Java8 so apply patch to
handle this better. (FELIX-4425)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1581477 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java b/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java
index e2fdba0..570b067 100644
--- a/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java
+++ b/gogo/shell/src/main/java/org/apache/felix/gogo/options/Options.java
@@ -470,16 +470,15 @@
}
}
else {
- int i = 0;
- for (String c : arg.substring(1).split("")) {
- if (i++ == 0)
- continue;
+ for (int i = 1; i < arg.length(); i++) {
+ String c = String.valueOf(arg.charAt(i));
if (optName.containsKey(c)) {
String name = optName.get(c);
optSet.put(name, true);
if (optArg.containsKey(name)) {
- if (i < arg.length()) {
- addArg(name, arg.substring(i));
+ int k = i + 1;
+ if (k < arg.length()) {
+ addArg(name, arg.substring(k));
}
else {
needOpt = c;