A DESCRIPTION OF THE PROBLEM :
Some flag combinations are illegal and cause an exception to be thrown. Which ones do this is not immediately obvious. The two illegal combinations are:
'-' with '0'
'+' with ' '
In addition, the argument index flag ('<') is not listed in the table of flags.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
In the Flags table, add the '<' flag line:
'<' y y y y y The argument for the previous format specifier will be re-used
At the end of the Flags section, just before the Width section, add:
An IllegalFormatFlagsException will be thrown if any one or both of the following pairs of flags occurs simultaneously:
'-' and '0' A left-justified result is zero-padded by definition
'+' and ' ' The result cannot both include a sign ('+' or '-') and a leading space for positive values
ACTUAL -
The documentation makes no mention of the illegal flag combinations.
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html
Some flag combinations are illegal and cause an exception to be thrown. Which ones do this is not immediately obvious. The two illegal combinations are:
'-' with '0'
'+' with ' '
In addition, the argument index flag ('<') is not listed in the table of flags.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
In the Flags table, add the '<' flag line:
'<' y y y y y The argument for the previous format specifier will be re-used
At the end of the Flags section, just before the Width section, add:
An IllegalFormatFlagsException will be thrown if any one or both of the following pairs of flags occurs simultaneously:
'-' and '0' A left-justified result is zero-padded by definition
'+' and ' ' The result cannot both include a sign ('+' or '-') and a leading space for positive values
ACTUAL -
The documentation makes no mention of the illegal flag combinations.
URL OF FAULTY DOCUMENTATION :
http://java.sun.com/j2se/1.5.0/docs/api/java/util/Formatter.html