8253393: Formatter does not throw exception for 0 as argument index
yano-masanori at fujitsu.com
yano-masanori at fujitsu.com
Mon Oct 12 02:53:32 UTC 2020
Hello.
I would like to contribute for JDK-8253393.
'java.util.Formatter' should treat "0$" as explicit argument index and throw an
exception according to the API specification.
> The first argument is referenced by "1$", the second by "2$", etc.
I propose the attached to fix 'java.util.Formatter' behavior properly as
described in the API specification.
Please sponsor the following change.
diff -r bdc20ee1a68d src/java.base/share/classes/java/util/Formatter.java
--- a/src/java.base/share/classes/java/util/Formatter.java Fri Sep 04 23:51:26 2020 -0400
+++ b/src/java.base/share/classes/java/util/Formatter.java Mon Oct 12 11:20:15 2020 +0900
@@ -2783,6 +2783,8 @@
try {
// skip the trailing '$'
index = Integer.parseInt(s, start, end - 1, 10);
+ if (index < 1)
+ throw new MissingFormatArgumentException(s.substring(start, end));
} catch (NumberFormatException x) {
assert(false);
}
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/Basic-X.java.template
--- a/test/jdk/java/util/Formatter/Basic-X.java.template Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/Basic-X.java.template Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
#end[dec]
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
#if[datetime]
//---------------------------------------------------------------------
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicBigDecimal.java
--- a/test/jdk/java/util/Formatter/BasicBigDecimal.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicBigDecimal.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -862,6 +865,9 @@
+
+
+
//---------------------------------------------------------------------
// %s - BigDecimal
//---------------------------------------------------------------------
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicBigInteger.java
--- a/test/jdk/java/util/Formatter/BasicBigInteger.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicBigInteger.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -777,6 +780,9 @@
+
+
+
//---------------------------------------------------------------------
// BigInteger - errors
//---------------------------------------------------------------------
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicBoolean.java
--- a/test/jdk/java/util/Formatter/BasicBoolean.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicBoolean.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -1661,6 +1664,9 @@
+
+
+
//---------------------------------------------------------------------
// %t
//
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicBooleanObject.java
--- a/test/jdk/java/util/Formatter/BasicBooleanObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicBooleanObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -1661,6 +1664,9 @@
+
+
+
//---------------------------------------------------------------------
// %t
//
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicByte.java
--- a/test/jdk/java/util/Formatter/BasicByte.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicByte.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicByteObject.java
--- a/test/jdk/java/util/Formatter/BasicByteObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicByteObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicChar.java
--- a/test/jdk/java/util/Formatter/BasicChar.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicChar.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -1661,6 +1664,9 @@
+
+
+
//---------------------------------------------------------------------
// %t
//
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicCharObject.java
--- a/test/jdk/java/util/Formatter/BasicCharObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicCharObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -1661,6 +1664,9 @@
+
+
+
//---------------------------------------------------------------------
// %t
//
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicDateTime.java
--- a/test/jdk/java/util/Formatter/BasicDateTime.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicDateTime.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -1661,6 +1664,9 @@
+
+
+
//---------------------------------------------------------------------
// %t
//
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicDouble.java
--- a/test/jdk/java/util/Formatter/BasicDouble.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicDouble.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -893,6 +896,9 @@
+
+
+
//---------------------------------------------------------------------
// %s - double
//---------------------------------------------------------------------
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicDoubleObject.java
--- a/test/jdk/java/util/Formatter/BasicDoubleObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicDoubleObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -903,6 +906,9 @@
+
+
+
//---------------------------------------------------------------------
// %s - Double
//---------------------------------------------------------------------
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicFloat.java
--- a/test/jdk/java/util/Formatter/BasicFloat.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicFloat.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -873,6 +876,9 @@
+
+
+
//---------------------------------------------------------------------
// %s - float
//---------------------------------------------------------------------
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicFloatObject.java
--- a/test/jdk/java/util/Formatter/BasicFloatObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicFloatObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -883,6 +886,9 @@
+
+
+
//---------------------------------------------------------------------
// %s - Float
//---------------------------------------------------------------------
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicInt.java
--- a/test/jdk/java/util/Formatter/BasicInt.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicInt.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicIntObject.java
--- a/test/jdk/java/util/Formatter/BasicIntObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicIntObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicLong.java
--- a/test/jdk/java/util/Formatter/BasicLong.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicLong.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicLongObject.java
--- a/test/jdk/java/util/Formatter/BasicLongObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicLongObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicShort.java
--- a/test/jdk/java/util/Formatter/BasicShort.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicShort.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
diff -r bdc20ee1a68d test/jdk/java/util/Formatter/BasicShortObject.java
--- a/test/jdk/java/util/Formatter/BasicShortObject.java Fri Sep 04 23:51:26 2020 -0400
+++ b/test/jdk/java/util/Formatter/BasicShortObject.java Mon Oct 12 11:20:15 2020 +0900
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -420,6 +420,7 @@
//---------------------------------------------------------------------
tryCatch("%#b", FormatFlagsConversionMismatchException.class);
tryCatch("%-b", MissingFormatWidthException.class);
+ tryCatch("%0$b", MissingFormatArgumentException.class);
// correct or side-effect of implementation?
tryCatch("%.b", UnknownFormatConversionException.class);
tryCatch("%,b", FormatFlagsConversionMismatchException.class);
@@ -467,6 +468,7 @@
tryCatch("%(c", FormatFlagsConversionMismatchException.class);
tryCatch("%$c", UnknownFormatConversionException.class);
tryCatch("%.2c", IllegalFormatPrecisionException.class);
+ tryCatch("%0$c", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %s
@@ -494,6 +496,7 @@
tryCatch("%#s", FormatFlagsConversionMismatchException.class, 0.5f);
tryCatch("%#s", FormatFlagsConversionMismatchException.class, "hello");
tryCatch("%#s", FormatFlagsConversionMismatchException.class, null);
+ tryCatch("%0$s", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %h
@@ -628,6 +631,7 @@
tryCatch("%0d", MissingFormatWidthException.class);
tryCatch("%-d", MissingFormatWidthException.class);
tryCatch("%7.3d", IllegalFormatPrecisionException.class);
+ tryCatch("%0$d", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %o
@@ -696,6 +700,7 @@
tryCatch("%-o", MissingFormatWidthException.class);
tryCatch("%,o", FormatFlagsConversionMismatchException.class);
tryCatch("%O", UnknownFormatConversionException.class);
+ tryCatch("%0$o", MissingFormatArgumentException.class);
//---------------------------------------------------------------------
// %x
@@ -773,6 +778,7 @@
tryCatch("%,x", FormatFlagsConversionMismatchException.class);
tryCatch("%0x", MissingFormatWidthException.class);
tryCatch("%-x", MissingFormatWidthException.class);
+ tryCatch("%0$x", MissingFormatArgumentException.class);
@@ -1679,6 +1685,7 @@
tryCatch("%.5tB", IllegalFormatPrecisionException.class);
tryCatch("%#tB", FormatFlagsConversionMismatchException.class);
tryCatch("%-tB", MissingFormatWidthException.class);
+ tryCatch("%0$t", MissingFormatArgumentException.class);
Regards,
Masanori Yano
More information about the core-libs-dev
mailing list