You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Argument Index of Zero or Unrepresentable by int Throws IllegalFormatException. (JDK-8253459)
core-libs/java.util
Format string specifiers now throw exceptions when given values outside of valid ranges of values.
The Formatter class in java.util defines format specifiers such as argument indexes, argument widths, and argument precisions. Numeric values that are invalid (zero for argument index) or too large (beyond the size of an int) could create unexpected results with undefined behavior. This update gives explicit value ranges for these format specifiers. Widths and indexes will be valid from [1, Integer.MAX_VALUE] and precision fields will be valid from [0, Integer.MAX_VALUE]. Values outside of these ranges will result in IllegalFormatException or one of its subclasses being thrown. Note that argument indexes of zero prior to this change did not throw an exception and produced behavior that was undefined, but had the appearance of correctness despite causing side effects that were not obvious.
The above error seems to be caused by setting the first argument of the String.format method to a value that exceeds the size of an int.
If Long.MAX_VALUE is modified to Integer.MAX_VALUE, the above error does not occur, but the following OutOfMemoryError occurs.
[ERROR] Tests run: 12, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 3.832 s <<< FAILURE! - in org.terasoluna.gfw.common.validator.constraints.ByteSizeTest
[ERROR] testSpecifyNotSpecifyMinAndMax(org.terasoluna.gfw.common.validator.constraints.ByteSizeTest) Time elapsed: 3.78 s <<< ERROR!
java.lang.OutOfMemoryError: Java heap space
at org.terasoluna.gfw.common.validator.constraints.ByteSizeTest.testSpecifyNotSpecifyMinAndMax(ByteSizeTest.java:197)
[ERROR] Errors:
[ERROR] ByteSizeTest.testSpecifyNotSpecifyMinAndMax:197 ≫ OutOfMemory Java heap space
[ERROR] Tests run: 56, Failures: 0, Errors: 1, Skipped: 0
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M3:test (default-test) on project terasoluna-gfw-validator: There are test failures.
The maximum value of int (Integer.MAX_VALUE) seems to cause insufficient memory.
If Long.MAX_VALUE is modified to 600000000, OutOfMemoryError will not occur and BUILD SUCCESS will occur.
Affect versions
Version in which the problem occurs. Current version if not known.
If there is a feature suggestion, please delete it.
5.x.x.RELEASE
Issue links
Links to related issues.
#xx
The text was updated successfully, but these errors were encountered:
Description
IllegalFormatWidthException occurs in String.format when running mvn-build-all.bat in Java17.
terasoluna-gfw/terasoluna-gfw-common-libraries/terasoluna-gfw-validator/src/test/java/org/terasoluna/gfw/common/validator/constraints/ByteSizeTest.java
Lines 196 to 197 in b5ae01e
The above error occurs in Java 16 and later.
Possible Solution
The following information can be found in the Release Notes for Java 16(http://jdk.java.net/16/release-notes)
The above error seems to be caused by setting the first argument of the String.format method to a value that exceeds the size of an int.
If Long.MAX_VALUE is modified to Integer.MAX_VALUE, the above error does not occur, but the following OutOfMemoryError occurs.
The maximum value of int (Integer.MAX_VALUE) seems to cause insufficient memory.
If Long.MAX_VALUE is modified to 600000000, OutOfMemoryError will not occur and BUILD SUCCESS will occur.
Affect versions
Issue links
The text was updated successfully, but these errors were encountered: