/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* Type-specific source code for unit test
*
* Regenerate the BasicX classes via genBasic.sh whenever this file changes.
* We check in the generated source files so that the test tree can be used
* independently of the rest of the source tree.
*/
// -- This file was mechanically generated: Do not edit! -- //
}
{
}
}
}
try {
} catch (FileNotFoundException ex) {
} catch (IOException ex) {
} finally {
try {
} catch (IOException ex) {
}
}
}
boolean caught = false;
try {
} catch (Throwable x) {
caught = true;
}
if (!caught)
else
pass();
}
boolean caught = false;
try {
} catch (Throwable x) {
caught = true;
}
if (!caught)
else
pass();
}
public static void test() {
// conversion suffixes, or flags are illegal and are reserved for
// future extensions. Use of such a character in a format string will
// cause an UnknownFormatConversionException or
// UnknownFormatFlagsException to be thrown.
//---------------------------------------------------------------------
// Formatter.java class javadoc examples
//---------------------------------------------------------------------
test("Amount gained or lost since last statement: $ %,(.2f",
"Amount gained or lost since last statement: $ (6,217.58)",
(new BigDecimal("-6217.58")));
test("Unable to open file '%1$s': %2$s",
"Unable to open file 'food': No such file or directory",
"food", "No such file or directory");
test("Duke's Birthday: %1$tB %1$te, %1$tY",
"Duke's Birthday: May 23, 1995",
duke);
test("Duke's Birthday: %1$tB %1$te, %1$tY",
"Duke's Birthday: May 23, 1995",
test("Duke's Birthday: %1$tB %1$te, %1$tY",
"Duke's Birthday: May 23, 1995",
duke.getTimeInMillis());
test("%4$s %3$s %2$s %1$s %4$s %3$s %2$s %1$s",
"d c b a d c b a", "a", "b", "c", "d");
//---------------------------------------------------------------------
// %b
//
// General conversion applicable to any argument.
//---------------------------------------------------------------------
// Boolean.java hardcodes the Strings for "true" and "false", so no
// localization is possible.
// If you pass in a single array to a varargs method, the compiler
// uses it as the array of arguments rather than treating it as a
// single array-type argument.
//---------------------------------------------------------------------
// %b - errors
//---------------------------------------------------------------------
// correct or side-effect of implementation?
//---------------------------------------------------------------------
// %c
//
// General conversion applicable to any argument.
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// %c - errors
//---------------------------------------------------------------------
(float) 0.1);
new Object());
//---------------------------------------------------------------------
// %s
//
// General conversion applicable to any argument.
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// %s - errors
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// %h
//
// General conversion applicable to any argument.
//---------------------------------------------------------------------
"Hello, Duke");
//---------------------------------------------------------------------
// %h - errors
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// flag/conversion errors
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// %t
//
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// %t - errors
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// %n
//---------------------------------------------------------------------
//---------------------------------------------------------------------
// %%
//---------------------------------------------------------------------
// perhaps an IllegalFormatArgumentIndexException should be defined?
}
}