diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java index ba62e7cccec377f50d7e9d24099c58b17e117921..cde30f30d320c1189d1cc1f2400a40e3ad2b24f2 100644 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java @@ -1621,6 +1621,7 @@ public class HtmlDocletWriter extends HtmlDocWriter { text = removeNonInlineHtmlTags(text); } text = Util.replaceTabs(configuration, text); + text = Util.normalizeNewlines(text); result.addContent(new RawHtml(text)); } } diff --git a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java index 1939d68f9fc45f7fda4d4543a4dc79ddc8300eb6..fc63f4f865465779b71790df3eec32314c32a503 100644 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java @@ -71,7 +71,7 @@ public class TagletWriterImpl extends TagletWriter { * {@inheritDoc} */ protected Content codeTagOutput(Tag tag) { - Content result = HtmlTree.CODE(new StringContent(tag.text())); + Content result = HtmlTree.CODE(new StringContent(Util.normalizeNewlines(tag.text()))); return result; } @@ -135,7 +135,7 @@ public class TagletWriterImpl extends TagletWriter { * {@inheritDoc} */ protected Content literalTagOutput(Tag tag) { - Content result = new StringContent(tag.text()); + Content result = new StringContent(Util.normalizeNewlines(tag.text())); return result; } diff --git a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java index acdae4545a723898a2dfc13a04be580a0bfbe5f7..289f34804e1240d8db9936625d91e71b8d9772e6 100644 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java @@ -631,6 +631,32 @@ public class Util { return result.toString(); } + public static String normalizeNewlines(String text) { + StringBuilder sb = new StringBuilder(); + final int textLength = text.length(); + final String NL = DocletConstants.NL; + int pos = 0; + for (int i = 0; i < textLength; i++) { + char ch = text.charAt(i); + switch (ch) { + case '\n': + sb.append(text, pos, i); + sb.append(NL); + pos = i + 1; + break; + case '\r': + sb.append(text, pos, i); + sb.append(NL); + if (i + 1 < textLength && text.charAt(i + 1) == '\n') + i++; + pos = i + 1; + break; + } + } + sb.append(text, pos, textLength); + return sb.toString(); + } + /** * The documentation for values() and valueOf() in Enums are set by the * doclet. diff --git a/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java b/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java index 99b523335e51190c31826eab710d5566c8f585e0..e12feabbebf702aa30c4e920b759df9a642deb0b 100644 --- a/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java +++ b/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, 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 @@ -38,7 +38,7 @@ import java.util.*; public class TestCRLineSeparator extends JavadocTester { //Test information. - private static final String BUG_ID = "4979486"; + private static final String BUG_ID = "4979486-8014636"; //Javadoc arguments. private static final String[] ARGS = new String[] { @@ -47,7 +47,7 @@ public class TestCRLineSeparator extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { - {BUG_ID + FS + "pkg" + FS + "MyClass.html", "Line 1\n Line 2"} + {BUG_ID + FS + "pkg" + FS + "MyClass.html", "Line 1" + NL + " Line 2"} }; private static final String[][] NEGATED_TEST = NO_TEST; diff --git a/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java b/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java index 65df0626c8574940c9b3b84bb6cfe0a756c7b873..11c3eaba73895ba96f858c921fd1d9edcc0f3761 100644 --- a/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java +++ b/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, 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 @@ -23,11 +23,11 @@ /* * @test - * @bug 4232882 + * @bug 4232882 8014636 * @summary Javadoc strips all of the leading spaces when the comment * does not begin with a star. This RFE allows users to * begin their comment without a leading star without leading - * spaces striped + * spaces stripped * @author jamieh * @library ../lib/ * @build JavadocTester @@ -37,15 +37,15 @@ public class LeadingSpaces extends JavadocTester { - private static final String BUG_ID = "4232882"; + private static final String BUG_ID = "4232882-8014636"; private static final String[][] TEST = { {BUG_ID + FS + "LeadingSpaces.html", -" 1\n" + -" 2\n" + -" 3\n" + -" 4\n" + -" 5\n" + -" 6\n" + +" 1" + NL + +" 2" + NL + +" 3" + NL + +" 4" + NL + +" 5" + NL + +" 6" + NL + " 7"} }; private static final String[][] NEGATED_TEST = NO_TEST; diff --git a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java index 74e81a8ed7416b1d57f7f9c42a1ec205ebaa3716..4720fe4d2bee411682bcb0295db897eb7487ed02 100644 --- a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java +++ b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, 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 @@ -23,7 +23,7 @@ /* * @test - * @bug 4732864 6280605 7064544 + * @bug 4732864 6280605 7064544 8014636 * @summary Make sure that you can link from one member to another using * non-qualified name, furthermore, ensure the right one is linked. * @author jamieh @@ -36,7 +36,7 @@ public class TestLinkTaglet extends JavadocTester { //Test information. - private static final String BUG_ID = "4732864-6280605-7064544"; + private static final String BUG_ID = "4732864-6280605-7064544-8014636"; //Javadoc arguments. private static final String[] ARGS = new String[] { @@ -46,16 +46,16 @@ public class TestLinkTaglet extends JavadocTester { //Input for string search tests. private static final String[][] TEST = { {BUG_ID + FS + "pkg" + FS + "C.html", - "Qualified Link: C.InnerC.
\n" + - " Unqualified Link1: C.InnerC.
\n" + - " Unqualified Link2: C.InnerC.
\n" + - " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
\n" + - " Unqualified Link: method(C.InnerC, C.InnerC2).
\n" + + "Qualified Link: C.InnerC.
" + NL + + " Unqualified Link1: C.InnerC.
" + NL + + " Unqualified Link2: C.InnerC.
" + NL + + " Qualified Link: method(pkg.C.InnerC, pkg.C.InnerC2).
" + NL + + " Unqualified Link: method(C.InnerC, C.InnerC2).
" + NL + " Unqualified Link: method(InnerC, InnerC2).
" }, {BUG_ID + FS + "pkg" + FS + "C.InnerC.html", - "Link to member in outer class: C.MEMBER
\n" + - " Link to member in inner class: C.InnerC2.MEMBER2
\n" + + "Link to member in outer class: C.MEMBER
" + NL + + " Link to member in inner class: C.InnerC2.MEMBER2
" + NL + " Link to another inner class: C.InnerC2" }, {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html", diff --git a/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java b/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java index bce27a98c00ab9e60a80b43bc57cc4e82a25459f..592dd524d2803ec6bd3f37dfcc7ad93d02925371 100644 --- a/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java +++ b/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8002387 + * @bug 8002387 8014636 * @summary Improve rendered HTML formatting for {@code} * @library ../lib/ * @build JavadocTester TestLiteralCodeInPre @@ -33,7 +33,7 @@ public class TestLiteralCodeInPre extends JavadocTester { //Test information. - private static final String BUG_ID = "8002387"; + private static final String BUG_ID = "8002387-8014636"; private static final String OUTPUT_DIR = BUG_ID; //Javadoc arguments. diff --git a/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java b/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java index e8c2d057753784c85fa175da3ff7d2dc60cc9f7d..513d738f6845506d40af5d126354edf850bba864 100644 --- a/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java +++ b/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, 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 @@ -23,11 +23,9 @@ /* * @test - * @bug 4460354 + * @bug 4460354 8014636 * @summary Test to make sure that relative paths are redirected in the * output so that they are not broken. - * NOTE: these tests have \\n instead of NL because they are user - * generated new lines, not Java generated. * @author jamieh * @library ../lib/ * @build JavadocTester @@ -38,7 +36,7 @@ public class TestRelativeLinks extends JavadocTester { //Test information. - private static final String BUG_ID = "4460354"; + private static final String BUG_ID = "4460354-8014636"; //Javadoc arguments. private static final String[] ARGS = new String[] { @@ -58,7 +56,7 @@ public class TestRelativeLinks extends JavadocTester { {BUG_ID + FS + "pkg" + FS + "package-summary.html", "relative package link"}, {BUG_ID + FS + "pkg" + FS + "C.html", - " relative-multi-line-link."}, //These relative paths should be redirected because they are in different @@ -74,7 +72,7 @@ public class TestRelativeLinks extends JavadocTester { {BUG_ID + FS + "index-all.html", "relative package link"}, {BUG_ID + FS + "index-all.html", - " relative-multi-line-link."}, @@ -92,7 +90,7 @@ public class TestRelativeLinks extends JavadocTester { {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", "relative package link"}, {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", - " relative-multi-line-link."}, //PACKAGE OVERVIEW