7010342: End tag for element P is not open for few html files generated using new javadoc
authorbpatel
Wed, 23 Mar 2011 14:40:18 -0700
changeset 9068 6697b4cbba1d
parent 9067 c0b85430843d
child 9069 bcab4a29758f
7010342: End tag for element P is not open for few html files generated using new javadoc Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css
langtools/test/com/sun/javadoc/testSubTitle/TestSubTitle.java
langtools/test/com/sun/javadoc/testSubTitle/pkg/C.java
langtools/test/com/sun/javadoc/testSubTitle/pkg/package.html
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Tue Mar 22 18:32:41 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Wed Mar 23 14:40:18 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -154,8 +154,8 @@
         div.addStyle(HtmlStyle.header);
         if (pkgname.length() > 0) {
             Content pkgNameContent = new StringContent(pkgname);
-            Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
-            div.addContent(pkgNamePara);
+            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
+            div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl(
                 LinkInfoImpl.CONTEXT_CLASS_HEADER, annotationType, false);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue Mar 22 18:32:41 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Wed Mar 23 14:40:18 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -161,8 +161,8 @@
         div.addStyle(HtmlStyle.header);
         if (pkgname.length() > 0) {
             Content pkgNameContent = new StringContent(pkgname);
-            Content pkgNamePara = HtmlTree.P(HtmlStyle.subTitle, pkgNameContent);
-            div.addContent(pkgNamePara);
+            Content pkgNameDiv = HtmlTree.DIV(HtmlStyle.subTitle, pkgNameContent);
+            div.addContent(pkgNameDiv);
         }
         LinkInfoImpl linkInfo = new LinkInfoImpl( LinkInfoImpl.CONTEXT_CLASS_HEADER,
                 classDoc, false);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Tue Mar 22 18:32:41 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HelpWriter.java	Wed Mar 23 14:40:18 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2011, 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
@@ -96,7 +96,7 @@
         Content heading = HtmlTree.HEADING(HtmlConstants.TITLE_HEADING, false, HtmlStyle.title,
                 getResource("doclet.Help_line_1"));
         Content div = HtmlTree.DIV(HtmlStyle.header, heading);
-        Content line2 = HtmlTree.P(HtmlStyle.subTitle,
+        Content line2 = HtmlTree.DIV(HtmlStyle.subTitle,
                 getResource("doclet.Help_line_2"));
         div.addContent(line2);
         contentTree.addContent(div);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Tue Mar 22 18:32:41 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Wed Mar 23 14:40:18 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -163,10 +163,10 @@
      */
     protected void addOverviewHeader(Content body) {
         if (root.inlineTags().length > 0) {
-            HtmlTree p = new HtmlTree(HtmlTag.P);
-            p.addStyle(HtmlStyle.subTitle);
-            addSummaryComment(root, p);
-            Content div = HtmlTree.DIV(HtmlStyle.header, p);
+            HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
+            subTitleDiv.addStyle(HtmlStyle.subTitle);
+            addSummaryComment(root, subTitleDiv);
+            Content div = HtmlTree.DIV(HtmlStyle.header, subTitleDiv);
             Content see = seeLabel;
             see.addContent(" ");
             Content descPara = HtmlTree.P(see);
@@ -188,10 +188,10 @@
     protected void addOverviewComment(Content htmltree) {
         if (root.inlineTags().length > 0) {
             htmltree.addContent(getMarkerAnchor("overview_description"));
-            HtmlTree p = new HtmlTree(HtmlTag.P);
-            p.addStyle(HtmlStyle.subTitle);
-            addInlineComment(root, p);
-            htmltree.addContent(p);
+            HtmlTree div = new HtmlTree(HtmlTag.DIV);
+            div.addStyle(HtmlStyle.subTitle);
+            addInlineComment(root, div);
+            htmltree.addContent(div);
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Tue Mar 22 18:32:41 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageWriterImpl.java	Wed Mar 23 14:40:18 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, 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
@@ -115,10 +115,10 @@
         tHeading.addContent(packageHead);
         div.addContent(tHeading);
         if (packageDoc.inlineTags().length > 0 && ! configuration.nocomment) {
-            HtmlTree p = new HtmlTree(HtmlTag.P);
-            p.addStyle(HtmlStyle.subTitle);
-            addSummaryComment(packageDoc, p);
-            div.addContent(p);
+            HtmlTree subTitleDiv = new HtmlTree(HtmlTag.DIV);
+            subTitleDiv.addStyle(HtmlStyle.subTitle);
+            addSummaryComment(packageDoc, subTitleDiv);
+            div.addContent(subTitleDiv);
             Content space = getSpace();
             Content descLink = getHyperLink("", "package_description",
                     descriptionLabel, "", "");
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Tue Mar 22 18:32:41 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css	Wed Mar 23 14:40:18 2011 -0700
@@ -183,8 +183,6 @@
 .subTitle {
     margin:0;
     padding-top:10px;
-    font-size:0.75em;
-    font-weight:bold;
 }
 /*
 Page layout container styles
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testSubTitle/TestSubTitle.java	Wed Mar 23 14:40:18 2011 -0700
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 7010342
+ * @summary Test for correct sub title generation.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester
+ * @build TestSubTitle
+ * @run main TestSubTitle
+ */
+
+public class TestSubTitle extends JavadocTester {
+
+    private static final String BUG_ID = "7010342";
+    private static final String[][] TEST = {
+        {BUG_ID + FS + "pkg" + FS + "package-summary.html",
+            "<div class=\"subTitle\">" + NL + "<div class=\"block\">This is the " +
+            "description of package pkg.</div>" + NL + "</div>"
+        },
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<div class=\"subTitle\">pkg</div>"
+        }
+    };
+    private static final String[][] NEG_TEST = {
+        {BUG_ID + FS + "pkg" + FS + "package-summary.html",
+            "<p class=\"subTitle\">" + NL + "<div class=\"block\">This is the " +
+            "description of package pkg.</div>" + NL + "</p>"
+        },
+        {BUG_ID + FS + "pkg" + FS + "C.html",
+            "<p class=\"subTitle\">pkg</p>"
+        }
+    };
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestSubTitle tester = new TestSubTitle();
+        run(tester, ARGS, TEST, NEG_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testSubTitle/pkg/C.java	Wed Mar 23 14:40:18 2011 -0700
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011, 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.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+/**
+ * Source file for C
+ */
+public class C {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testSubTitle/pkg/package.html	Wed Mar 23 14:40:18 2011 -0700
@@ -0,0 +1,8 @@
+<html lang="en">
+<head>
+    <title>Package Summary</title>
+</head>
+<body>
+This is the description of package pkg.
+</body>
+</html>