Details
-
Bug
-
Resolution: Fixed
-
P4
-
8, 11, 14, 15
-
b26
-
Verified
Description
A DESCRIPTION OF THE PROBLEM :
The source code of java.util.Formatter has 3 `assert(false)` statements:
- When the argument index cannot be parsed as int
- When the width cannot be parsed as int
- When the precision cannot be parsed as int
All of them can be triggered when the arguments are > Integer.MAX_VALUE. Expected would be that an exception is thrown.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected exceptions to be thrown
---------- BEGIN SOURCE ----------
String.format("%2147483648s", 1) // Acts like no explicit width
String.format("%s %2147483648$s", 1) // Acts like "Relative indexing"
String.format("%.2147483648f", 1.0) // Acts like no explicit precision
---------- END SOURCE ----------
The source code of java.util.Formatter has 3 `assert(false)` statements:
- When the argument index cannot be parsed as int
- When the width cannot be parsed as int
- When the precision cannot be parsed as int
All of them can be triggered when the arguments are > Integer.MAX_VALUE. Expected would be that an exception is thrown.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Expected exceptions to be thrown
---------- BEGIN SOURCE ----------
String.format("%2147483648s", 1) // Acts like no explicit width
String.format("%s %2147483648$s", 1) // Acts like "Relative indexing"
String.format("%.2147483648f", 1.0) // Acts like no explicit precision
---------- END SOURCE ----------
Attachments
Issue Links
- csr for
-
JDK-8253875 Formatter treats index, width and precision > Integer.MAX_VALUE incorrectly
- Closed
- duplicates
-
JDK-5035504 (fmt) assertion error in Formatter for width
- Closed
-
JDK-8253393 Formatter does not throw exception for 0 as argument index
- Closed
- relates to
-
JDK-8253393 Formatter does not throw exception for 0 as argument index
- Closed
(1 links to)