+1

Not a big deal, but a simpler solution would have been to just use startDate in 
the checkOutput string.

Hannes

> Am 15.03.2019 um 20:00 schrieb Jonathan Gibbons <[email protected]>:
> 
> Please review a small test-only fix, to suppress the check for the date in 
> the generated files when the date has changed since the test started (i.e.the 
> date was run close to midnight.)  And yes, this did just happen!
> 
> JBS: https://bugs.openjdk.java.net/browse/JDK-8220693
> 
> -- Jon
> 
> $ hg diff
> diff -r c61f09122d3b test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java
> --- a/test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java    Fri Mar 15 
> 18:59:21 2019 +0100
> +++ b/test/langtools/jdk/javadoc/doclet/MetaTag/MetaTag.java    Fri Mar 15 
> 11:56:19 2019 -0700
> @@ -93,14 +93,19 @@
>                  "<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());
>      }
>  }
> 

Reply via email to