Oh, I get it. Sorry for not thinking this through.

Hannes


> Am 18.03.2019 um 15:44 schrieb Jonathan Gibbons <[email protected]>:
> 
> Thanks,
> 
> You can't use any specific date in checkOutput because you do not know the 
> date used by javadoc to write into the file ... because the date is so near 
> the boundary at which it changes.  That why, given the condition is 
> relatively uncommon, it is better to skip this test when it might occur.
> 
> -- Jon
> 
> 
> On 3/18/19 6:42 AM, Hannes Wallnöfer wrote:
>> +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