Description
The following test program illustrates that the format specifier returned
by MissingFormatArgumentException.getFormatSpecifier() does not correspond
to the one in the original format string as required by specification.
In fact, the returned value isn't even a syntactically valid format specifier.
==========$ cat -n T.java
1 import java.util.*;
2 class T {
3 public static void main(String[] args) {
4 String spec = "%1$5.3s";
5 try {
6 String s2 = String.format(spec);
7 } catch (MissingFormatArgumentException ex) {
8 if (!ex.getFormatSpecifier().equals(spec))
9 throw new Error(ex.getFormatSpecifier());
10 System.out.println("passed");
11 }
12 }
13 }
==========$ /usr/j2sdk1.5.0/bin/javac T.java
==========$ /usr/j2sdk1.5.0/bin/java T
Exception in thread "main" java.lang.Error: 1$5.3s
at T.main(T.java:9)
==========$
by MissingFormatArgumentException.getFormatSpecifier() does not correspond
to the one in the original format string as required by specification.
In fact, the returned value isn't even a syntactically valid format specifier.
==========$ cat -n T.java
1 import java.util.*;
2 class T {
3 public static void main(String[] args) {
4 String spec = "%1$5.3s";
5 try {
6 String s2 = String.format(spec);
7 } catch (MissingFormatArgumentException ex) {
8 if (!ex.getFormatSpecifier().equals(spec))
9 throw new Error(ex.getFormatSpecifier());
10 System.out.println("passed");
11 }
12 }
13 }
==========$ /usr/j2sdk1.5.0/bin/javac T.java
==========$ /usr/j2sdk1.5.0/bin/java T
Exception in thread "main" java.lang.Error: 1$5.3s
at T.main(T.java:9)
==========$