Skip to content

Commit a069530

Browse files
committed
Formatter fix after Java8 regex upgrade
1 parent 5af3957 commit a069530

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sources/net.sf.j2s.java.core/src/java/util/Formatter.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,9 +2262,10 @@ private FormatString[] parse(String s) {
22622262
}
22632263

22642264
// Expect 6 groups in regular expression
2265-
// %[argument_index$][flags][width][.precision][t]conversion
2266-
// 0 1 2 3 4 5
2267-
int n = m.groupCount() - 1;
2265+
// (expr) %[argument_index$][flags][width][.precision][t]conversion
2266+
// $0 $1 $2 $3 $4 $5 $6
2267+
// sa[] 0 1 2 3 4 5
2268+
int n = m.groupCount();
22682269
String[] sa = new String[n];
22692270
for (int j = 0; j < n; j++) {
22702271
sa[j] = m.group(j + 1);
@@ -3898,7 +3899,7 @@ public Flags remove(Flags f) {
38983899

38993900
public static Flags parse(String s) {
39003901
Flags f = new Flags(0);
3901-
if (s == null)
3902+
if (s == null || s.length() == 0)
39023903
return f;
39033904
char[] ca = s.toCharArray();
39043905
for (int i = 0; i < ca.length; i++) {

0 commit comments

Comments
 (0)