8220693: jdk/javadoc/doclet/MetaTag/MetaTag.java with unexpected date

Reviewed-by: hannesw
This commit is contained in:
Jonathan Gibbons 2019-03-18 11:50:57 -07:00
parent f05457a1af
commit 7954db81f8

@ -93,14 +93,19 @@ public class MetaTag extends JavadocTester {
"<meta name=\"keywords\" content=\"Overview, Sample Packages\">");
// NOTE: Hopefully, this regression test is not run at midnight. If the output
// was generated yesterday and this test is run today, the test will fail.
checkOutput("overview-summary.html", found,
"<meta name=\"" + metaNameDate + "\" content=\"" + date() + "\">");
// was generated yesterday and this test is run today, this check could fail ...
// so make sure the date has not changed since the test started
String date = date();
if (date.equals(startDate)) {
checkOutput("overview-summary.html", found,
"<meta name=\"" + metaNameDate + "\" content=\"" + date + "\">");
}
}
private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
private static final String startDate = date();
String date() {
static String date() {
return dateFormat.format(new Date());
}
}