Wed, 17 Jul 2013 18:18:45 -0700
8014636: TestLiteralCodeInPre fails on windows
Reviewed-by: ksrini
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Jul 17 10:40:53 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Wed Jul 17 18:18:45 2013 -0700 1.3 @@ -1621,6 +1621,7 @@ 1.4 text = removeNonInlineHtmlTags(text); 1.5 } 1.6 text = Util.replaceTabs(configuration, text); 1.7 + text = Util.normalizeNewlines(text); 1.8 result.addContent(new RawHtml(text)); 1.9 } 1.10 }
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Wed Jul 17 10:40:53 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Wed Jul 17 18:18:45 2013 -0700 2.3 @@ -71,7 +71,7 @@ 2.4 * {@inheritDoc} 2.5 */ 2.6 protected Content codeTagOutput(Tag tag) { 2.7 - Content result = HtmlTree.CODE(new StringContent(tag.text())); 2.8 + Content result = HtmlTree.CODE(new StringContent(Util.normalizeNewlines(tag.text()))); 2.9 return result; 2.10 } 2.11 2.12 @@ -135,7 +135,7 @@ 2.13 * {@inheritDoc} 2.14 */ 2.15 protected Content literalTagOutput(Tag tag) { 2.16 - Content result = new StringContent(tag.text()); 2.17 + Content result = new StringContent(Util.normalizeNewlines(tag.text())); 2.18 return result; 2.19 } 2.20
3.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Wed Jul 17 10:40:53 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java Wed Jul 17 18:18:45 2013 -0700 3.3 @@ -631,6 +631,32 @@ 3.4 return result.toString(); 3.5 } 3.6 3.7 + public static String normalizeNewlines(String text) { 3.8 + StringBuilder sb = new StringBuilder(); 3.9 + final int textLength = text.length(); 3.10 + final String NL = DocletConstants.NL; 3.11 + int pos = 0; 3.12 + for (int i = 0; i < textLength; i++) { 3.13 + char ch = text.charAt(i); 3.14 + switch (ch) { 3.15 + case '\n': 3.16 + sb.append(text, pos, i); 3.17 + sb.append(NL); 3.18 + pos = i + 1; 3.19 + break; 3.20 + case '\r': 3.21 + sb.append(text, pos, i); 3.22 + sb.append(NL); 3.23 + if (i + 1 < textLength && text.charAt(i + 1) == '\n') 3.24 + i++; 3.25 + pos = i + 1; 3.26 + break; 3.27 + } 3.28 + } 3.29 + sb.append(text, pos, textLength); 3.30 + return sb.toString(); 3.31 + } 3.32 + 3.33 /** 3.34 * The documentation for values() and valueOf() in Enums are set by the 3.35 * doclet.
4.1 --- a/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java Wed Jul 17 10:40:53 2013 -0700 4.2 +++ b/test/com/sun/javadoc/testCRLineSeparator/TestCRLineSeparator.java Wed Jul 17 18:18:45 2013 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -38,7 +38,7 @@ 4.11 public class TestCRLineSeparator extends JavadocTester { 4.12 4.13 //Test information. 4.14 - private static final String BUG_ID = "4979486"; 4.15 + private static final String BUG_ID = "4979486-8014636"; 4.16 4.17 //Javadoc arguments. 4.18 private static final String[] ARGS = new String[] { 4.19 @@ -47,7 +47,7 @@ 4.20 4.21 //Input for string search tests. 4.22 private static final String[][] TEST = { 4.23 - {BUG_ID + FS + "pkg" + FS + "MyClass.html", "Line 1\n Line 2"} 4.24 + {BUG_ID + FS + "pkg" + FS + "MyClass.html", "Line 1" + NL + " Line 2"} 4.25 }; 4.26 4.27 private static final String[][] NEGATED_TEST = NO_TEST;
5.1 --- a/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java Wed Jul 17 10:40:53 2013 -0700 5.2 +++ b/test/com/sun/javadoc/testLeadingSpaces/LeadingSpaces.java Wed Jul 17 18:18:45 2013 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 /* 5.5 - * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved. 5.6 + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 * 5.9 * This code is free software; you can redistribute it and/or modify it 5.10 @@ -23,11 +23,11 @@ 5.11 5.12 /* 5.13 * @test 5.14 - * @bug 4232882 5.15 + * @bug 4232882 8014636 5.16 * @summary Javadoc strips all of the leading spaces when the comment 5.17 * does not begin with a star. This RFE allows users to 5.18 * begin their comment without a leading star without leading 5.19 - * spaces striped 5.20 + * spaces stripped 5.21 * @author jamieh 5.22 * @library ../lib/ 5.23 * @build JavadocTester 5.24 @@ -37,15 +37,15 @@ 5.25 5.26 public class LeadingSpaces extends JavadocTester { 5.27 5.28 - private static final String BUG_ID = "4232882"; 5.29 + private static final String BUG_ID = "4232882-8014636"; 5.30 private static final String[][] TEST = { 5.31 {BUG_ID + FS + "LeadingSpaces.html", 5.32 -" 1\n" + 5.33 -" 2\n" + 5.34 -" 3\n" + 5.35 -" 4\n" + 5.36 -" 5\n" + 5.37 -" 6\n" + 5.38 +" 1" + NL + 5.39 +" 2" + NL + 5.40 +" 3" + NL + 5.41 +" 4" + NL + 5.42 +" 5" + NL + 5.43 +" 6" + NL + 5.44 " 7"} 5.45 }; 5.46 private static final String[][] NEGATED_TEST = NO_TEST;
6.1 --- a/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Wed Jul 17 10:40:53 2013 -0700 6.2 +++ b/test/com/sun/javadoc/testLinkTaglet/TestLinkTaglet.java Wed Jul 17 18:18:45 2013 -0700 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -23,7 +23,7 @@ 6.11 6.12 /* 6.13 * @test 6.14 - * @bug 4732864 6280605 7064544 6.15 + * @bug 4732864 6280605 7064544 8014636 6.16 * @summary Make sure that you can link from one member to another using 6.17 * non-qualified name, furthermore, ensure the right one is linked. 6.18 * @author jamieh 6.19 @@ -36,7 +36,7 @@ 6.20 public class TestLinkTaglet extends JavadocTester { 6.21 6.22 //Test information. 6.23 - private static final String BUG_ID = "4732864-6280605-7064544"; 6.24 + private static final String BUG_ID = "4732864-6280605-7064544-8014636"; 6.25 6.26 //Javadoc arguments. 6.27 private static final String[] ARGS = new String[] { 6.28 @@ -46,16 +46,16 @@ 6.29 //Input for string search tests. 6.30 private static final String[][] TEST = { 6.31 {BUG_ID + FS + "pkg" + FS + "C.html", 6.32 - "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" + 6.33 - " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" + 6.34 - " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" + 6.35 - " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>\n" + 6.36 - " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n" + 6.37 + "Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + 6.38 + " Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + 6.39 + " Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL + 6.40 + " Qualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(pkg.C.InnerC, pkg.C.InnerC2)</code></a>.<br/>" + NL + 6.41 + " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL + 6.42 " Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>" 6.43 }, 6.44 {BUG_ID + FS + "pkg" + FS + "C.InnerC.html", 6.45 - "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n" + 6.46 - " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n" + 6.47 + "Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL + 6.48 + " Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>" + NL + 6.49 " Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>" 6.50 }, 6.51 {BUG_ID + FS + "pkg" + FS + "C.InnerC2.html",
7.1 --- a/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java Wed Jul 17 10:40:53 2013 -0700 7.2 +++ b/test/com/sun/javadoc/testLiteralCodeInPre/TestLiteralCodeInPre.java Wed Jul 17 18:18:45 2013 -0700 7.3 @@ -23,7 +23,7 @@ 7.4 7.5 /* 7.6 * @test 7.7 - * @bug 8002387 7.8 + * @bug 8002387 8014636 7.9 * @summary Improve rendered HTML formatting for {@code} 7.10 * @library ../lib/ 7.11 * @build JavadocTester TestLiteralCodeInPre 7.12 @@ -33,7 +33,7 @@ 7.13 public class TestLiteralCodeInPre extends JavadocTester { 7.14 7.15 //Test information. 7.16 - private static final String BUG_ID = "8002387"; 7.17 + private static final String BUG_ID = "8002387-8014636"; 7.18 private static final String OUTPUT_DIR = BUG_ID; 7.19 7.20 //Javadoc arguments.
8.1 --- a/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java Wed Jul 17 10:40:53 2013 -0700 8.2 +++ b/test/com/sun/javadoc/testRelativeLinks/TestRelativeLinks.java Wed Jul 17 18:18:45 2013 -0700 8.3 @@ -1,5 +1,5 @@ 8.4 /* 8.5 - * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved. 8.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 8.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.8 * 8.9 * This code is free software; you can redistribute it and/or modify it 8.10 @@ -23,11 +23,9 @@ 8.11 8.12 /* 8.13 * @test 8.14 - * @bug 4460354 8.15 + * @bug 4460354 8014636 8.16 * @summary Test to make sure that relative paths are redirected in the 8.17 * output so that they are not broken. 8.18 - * NOTE: these tests have \\n instead of NL because they are user 8.19 - * generated new lines, not Java generated. 8.20 * @author jamieh 8.21 * @library ../lib/ 8.22 * @build JavadocTester 8.23 @@ -38,7 +36,7 @@ 8.24 public class TestRelativeLinks extends JavadocTester { 8.25 8.26 //Test information. 8.27 - private static final String BUG_ID = "4460354"; 8.28 + private static final String BUG_ID = "4460354-8014636"; 8.29 8.30 //Javadoc arguments. 8.31 private static final String[] ARGS = new String[] { 8.32 @@ -58,7 +56,7 @@ 8.33 {BUG_ID + FS + "pkg" + FS + "package-summary.html", 8.34 "<a href=\"relative-package-link.html\">relative package link</a>"}, 8.35 {BUG_ID + FS + "pkg" + FS + "C.html", 8.36 - " <a\n" + 8.37 + " <a" + NL + 8.38 " href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."}, 8.39 8.40 //These relative paths should be redirected because they are in different 8.41 @@ -74,7 +72,7 @@ 8.42 {BUG_ID + FS + "index-all.html", 8.43 "<a href=\"./pkg/relative-package-link.html\">relative package link</a>"}, 8.44 {BUG_ID + FS + "index-all.html", 8.45 - " <a\n" + 8.46 + " <a" + NL + 8.47 " href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."}, 8.48 8.49 8.50 @@ -92,7 +90,7 @@ 8.51 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", 8.52 "<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"}, 8.53 {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html", 8.54 - " <a\n" + 8.55 + " <a" + NL + 8.56 " href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."}, 8.57 8.58 //PACKAGE OVERVIEW