File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed
checker-util/src/main/java/org/checkerframework/checker/formatter/util Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -93,14 +93,19 @@ public static String asFormat(String format, ConversionCategory... cc)
9393 * @throws IllegalFormatException if the format string is invalid
9494 */
9595 public static void tryFormatSatisfiability (String format ) throws IllegalFormatException {
96- @ SuppressWarnings ({
97- "unused" , // called for side effect, to see if it throws an exception
98- "nullness:argument" , // it's not documented, but String.format permits
99- // a null array, which it treats as matching any format string (null is supplied to each
100- // format specifier).
101- "formatter:format.string" , // this is a test of format string validity
102- })
103- String unused = String .format (format , (Object []) null );
96+ try {
97+ @ SuppressWarnings ({
98+ "unused" , // called for side effect, to see if it throws an exception
99+ "nullness:argument" , // it's not documented, but String.format permits
100+ // a null array, which it treats as matching any format string (null is supplied to each
101+ // format specifier).
102+ "formatter:format.string" , // this is a test of format string validity
103+ })
104+ String unused = String .format (format , (Object []) null );
105+ } catch (OutOfMemoryError e ) {
106+ throw new Error (
107+ "OOM while calling String.format on (length " + format .length () + "): " + format );
108+ }
104109 }
105110
106111 /**
You can’t perform that action at this time.
0 commit comments