< prev index next >
test/jdk/java/text/Format/DateFormat/DateFormatRegression.java
Print this page
8247706: Unintentional use of new Date(year...) with absolute year
Reviewed-by: naoto, rriggs, scolebourne
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -1065,11 +1065,11 @@
// XXX: Test assumes "PST" is not TimeZoneNames_ja. Need to
// pick up another time zone when L10N is done to that file.
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
SimpleDateFormat fmt = new SimpleDateFormat("yy/MM/dd hh:ss zzz", Locale.JAPAN);
@SuppressWarnings("deprecation")
- String result = fmt.format(new Date(1999, 0, 1));
+ String result = fmt.format(new Date(1999 - 1900, 0, 1));
logln("format()=>" + result);
if (!result.endsWith("PST")) {
errln("FAIL: SimpleDataFormat.format() did not retrun PST");
}
< prev index next >