OpenJDK / jdk / jdk
changeset 57659:4d1fe278c90e
8223536: jdk/javadoc/doclet/MetaTag/MetaTag.java still fails when run across midnight
Reviewed-by: prappo
author | jjg |
---|---|
date | Wed, 15 Jan 2020 11:21:48 -0800 |
parents | 53b6aad22933 |
children | 49169918ed1e |
files | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java |
diffstat | 5 files changed, 16 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Wed Jan 15 20:04:51 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java Wed Jan 15 11:21:48 2020 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, 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 @@ -262,6 +262,7 @@ private static final String versionBundleName = "jdk.javadoc.internal.tool.resources.version"; private static final String defaultDocletVersion = System.getProperty("java.version"); public final String docletVersion; + public final Date startTime = new Date(); @Override public String getDocletVersion() {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Wed Jan 15 20:04:51 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java Wed Jan 15 11:21:48 2020 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2019, 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 @@ -447,7 +447,7 @@ Content htmlComment = contents.newPage; List<DocPath> additionalStylesheets = configuration.getAdditionalStylesheets(); additionalStylesheets.addAll(localStylesheets); - Head head = new Head(path, configuration.docletVersion) + Head head = new Head(path, configuration.docletVersion, configuration.startTime) .setTimestamp(!configuration.notimestamp) .setDescription(description) .setGenerator(getGenerator(getClass()))
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java Wed Jan 15 20:04:51 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java Wed Jan 15 11:21:48 2020 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -74,7 +74,7 @@ */ private void generateIndexFile() throws DocFileIOException { Content htmlComment = contents.newPage; - Head head = new Head(path, configuration.docletVersion) + Head head = new Head(path, configuration.docletVersion, configuration.startTime) .setTimestamp(!configuration.notimestamp) .setDescription("index redirect") .setGenerator(getGenerator(getClass()))
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java Wed Jan 15 20:04:51 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SourceToHTMLConverter.java Wed Jan 15 11:21:48 2020 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 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 @@ -235,7 +235,7 @@ * @param path the path for the file. */ private void writeToFile(Content body, DocPath path, TypeElement te) throws DocFileIOException { - Head head = new Head(path, configuration.docletVersion) + Head head = new Head(path, configuration.docletVersion, configuration.startTime) // .setTimestamp(!configuration.notimestamp) // temporary: compatibility! .setTitle(resources.getText("doclet.Window_Source_title")) // .setCharset(configuration.charset) // temporary: compatibility!
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java Wed Jan 15 20:04:51 2020 +0100 +++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java Wed Jan 15 11:21:48 2020 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -28,15 +28,11 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; -import java.util.Calendar; import java.util.Collections; import java.util.Date; -import java.util.GregorianCalendar; import java.util.List; -import java.util.TimeZone; import jdk.javadoc.internal.doclets.toolkit.Content; -import jdk.javadoc.internal.doclets.toolkit.util.DocFile; import jdk.javadoc.internal.doclets.toolkit.util.DocPath; import jdk.javadoc.internal.doclets.toolkit.util.DocPaths; @@ -52,6 +48,7 @@ */ public class Head { private final String docletVersion; + private final Date generatedDate; private final DocPath pathToRoot; private String title; private String charset; @@ -68,8 +65,6 @@ private boolean addDefaultScript = true; private DocPath canonicalLink; - private static final Calendar calendar = new GregorianCalendar(TimeZone.getDefault()); - /** * Creates a {@code Head} object, for a given file and HTML version. * The file is used to help determine the relative paths to stylesheet and script files. @@ -79,8 +74,9 @@ * @param path the path for the file that will include this HEAD element * @param docletVersion a string identifying the doclet version */ - public Head(DocPath path, String docletVersion) { + public Head(DocPath path, String docletVersion, Date generatedDate) { this.docletVersion = docletVersion; + this.generatedDate = generatedDate; pathToRoot = path.parent().invert(); keywords = new ArrayList<>(); scripts = new ArrayList<>(); @@ -215,7 +211,7 @@ * Specifies a value for a * <a href="https://en.wikipedia.org/wiki/Canonical_link_element">canonical link</a> * in the {@code <head>} element. - * @param link + * @param link the value for the canonical link */ public void setCanonicalLink(DocPath link) { this.canonicalLink = link; @@ -238,10 +234,8 @@ * @return the HTML */ public Content toContent() { - Date now = showTimestamp ? calendar.getTime() : null; - HtmlTree tree = new HtmlTree(HtmlTag.HEAD); - tree.add(getGeneratedBy(showTimestamp, now)); + tree.add(getGeneratedBy(showTimestamp, generatedDate)); tree.add(HtmlTree.TITLE(title)); if (charset != null) { // compatibility; should this be allowed? @@ -250,7 +244,7 @@ if (showTimestamp) { SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - tree.add(HtmlTree.META("dc.created", dateFormat.format(now))); + tree.add(HtmlTree.META("dc.created", dateFormat.format(generatedDate))); } if (description != null) { @@ -317,7 +311,7 @@ mainBodyScript.append("var pathtoroot = ") .appendStringLiteral(ptrPath + "/") .append(";\n") - .append("loadScripts(document, \'script\');"); + .append("loadScripts(document, 'script');"); } addJQueryFile(tree, DocPaths.JSZIP_MIN); addJQueryFile(tree, DocPaths.JSZIPUTILS_MIN);