remove accidental use of 1.5+ method
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@592063 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
157ae91e13
commit
565d75665f
|
@ -71,26 +71,27 @@ public class ExtendedMessageFormat extends MessageFormat {
|
||||||
private String stripFormats(String pattern) {
|
private String stripFormats(String pattern) {
|
||||||
StringBuffer sb = new StringBuffer(pattern.length());
|
StringBuffer sb = new StringBuffer(pattern.length());
|
||||||
ParsePosition pos = new ParsePosition(0);
|
ParsePosition pos = new ParsePosition(0);
|
||||||
|
char[] c = pattern.toCharArray();
|
||||||
while (pos.getIndex() < pattern.length()) {
|
while (pos.getIndex() < pattern.length()) {
|
||||||
switch (pattern.charAt(pos.getIndex())) {
|
switch (c[pos.getIndex()]) {
|
||||||
case QUOTE:
|
case QUOTE:
|
||||||
appendQuotedString(pattern, pos, sb, true);
|
appendQuotedString(pattern, pos, sb, true);
|
||||||
break;
|
break;
|
||||||
case START_FE:
|
case START_FE:
|
||||||
int start = pos.getIndex();
|
int start = pos.getIndex();
|
||||||
readArgumentIndex(pattern, next(pos));
|
readArgumentIndex(pattern, next(pos));
|
||||||
sb.append(pattern, start, pos.getIndex());
|
sb.append(c, start, pos.getIndex() - start);
|
||||||
if (pattern.charAt(pos.getIndex()) == START_FMT) {
|
if (c[pos.getIndex()] == START_FMT) {
|
||||||
eatFormat(pattern, next(pos));
|
eatFormat(pattern, next(pos));
|
||||||
}
|
}
|
||||||
if (pattern.charAt(pos.getIndex()) != END_FE) {
|
if (c[pos.getIndex()] != END_FE) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"Unreadable format element at position "
|
"Unreadable format element at position "
|
||||||
+ start);
|
+ start);
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
default:
|
default:
|
||||||
sb.append(pattern.charAt(pos.getIndex()));
|
sb.append(c[pos.getIndex()]);
|
||||||
next(pos);
|
next(pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -191,24 +192,25 @@ public class ExtendedMessageFormat extends MessageFormat {
|
||||||
private StringBuffer appendQuotedString(String pattern,
|
private StringBuffer appendQuotedString(String pattern,
|
||||||
ParsePosition pos, StringBuffer appendTo, boolean escapingOn) {
|
ParsePosition pos, StringBuffer appendTo, boolean escapingOn) {
|
||||||
int start = pos.getIndex();
|
int start = pos.getIndex();
|
||||||
if (escapingOn && pattern.charAt(start) == QUOTE) {
|
char[] c = pattern.toCharArray();
|
||||||
|
if (escapingOn && c[start] == QUOTE) {
|
||||||
return appendTo == null ? null : appendTo.append(QUOTE);
|
return appendTo == null ? null : appendTo.append(QUOTE);
|
||||||
}
|
}
|
||||||
int lastHold = start;
|
int lastHold = start;
|
||||||
for (int i = pos.getIndex(); i < pattern.length(); i++) {
|
for (int i = pos.getIndex(); i < pattern.length(); i++) {
|
||||||
if (escapingOn
|
if (escapingOn
|
||||||
&& pattern.substring(i).startsWith(ESCAPED_QUOTE)) {
|
&& pattern.substring(i).startsWith(ESCAPED_QUOTE)) {
|
||||||
appendTo.append(pattern, lastHold, pos.getIndex()).append(
|
appendTo.append(c, lastHold, pos.getIndex() - lastHold).append(
|
||||||
QUOTE);
|
QUOTE);
|
||||||
pos.setIndex(i + ESCAPED_QUOTE.length());
|
pos.setIndex(i + ESCAPED_QUOTE.length());
|
||||||
lastHold = pos.getIndex();
|
lastHold = pos.getIndex();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
switch (pattern.charAt(pos.getIndex())) {
|
switch (c[pos.getIndex()]) {
|
||||||
case QUOTE:
|
case QUOTE:
|
||||||
next(pos);
|
next(pos);
|
||||||
return appendTo == null ? null : appendTo.append(pattern,
|
return appendTo == null ? null : appendTo.append(c,
|
||||||
lastHold, pos.getIndex());
|
lastHold, pos.getIndex() - lastHold);
|
||||||
default:
|
default:
|
||||||
next(pos);
|
next(pos);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue