提交 be2674dc 编写于 作者: J jjg

8014636: TestLiteralCodeInPre fails on windows

Reviewed-by: ksrini
上级 7dd21645
......@@ -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));
}
}
......
......@@ -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;
}
......
......@@ -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.
......
/*
* 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;
......
/*
* 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;
......
/*
* 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: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
" Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
" Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>\n" +
" 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" +
" Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>\n" +
"Qualified Link: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
" Unqualified Link1: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
" Unqualified Link2: <a href=\"../pkg/C.InnerC.html\" title=\"class in pkg\"><code>C.InnerC</code></a>.<br/>" + NL +
" 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 +
" Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(C.InnerC, C.InnerC2)</code></a>.<br/>" + NL +
" Unqualified Link: <a href=\"../pkg/C.html#method(pkg.C.InnerC, pkg.C.InnerC2)\"><code>method(InnerC, InnerC2)</code></a>.<br/>"
},
{BUG_ID + FS + "pkg" + FS + "C.InnerC.html",
"Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>\n" +
" Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>\n" +
"Link to member in outer class: <a href=\"../pkg/C.html#MEMBER\"><code>C.MEMBER</code></a> <br/>" + NL +
" Link to member in inner class: <a href=\"../pkg/C.InnerC2.html#MEMBER2\"><code>C.InnerC2.MEMBER2</code></a> <br/>" + NL +
" Link to another inner class: <a href=\"../pkg/C.InnerC2.html\" title=\"class in pkg\"><code>C.InnerC2</code></a>"
},
{BUG_ID + FS + "pkg" + FS + "C.InnerC2.html",
......
......@@ -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.
......
/*
* 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",
"<a href=\"relative-package-link.html\">relative package link</a>"},
{BUG_ID + FS + "pkg" + FS + "C.html",
" <a\n" +
" <a" + NL +
" href=\"relative-multi-line-link.html\">relative-multi-line-link</a>."},
//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",
"<a href=\"./pkg/relative-package-link.html\">relative package link</a>"},
{BUG_ID + FS + "index-all.html",
" <a\n" +
" <a" + NL +
" href=\"./pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
......@@ -92,7 +90,7 @@ public class TestRelativeLinks extends JavadocTester {
{BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
"<a href=\"../../pkg/relative-package-link.html\">relative package link</a>"},
{BUG_ID + FS + "pkg" + FS + "class-use" + FS + "C.html",
" <a\n" +
" <a" + NL +
" href=\"../../pkg/relative-multi-line-link.html\">relative-multi-line-link</a>."},
//PACKAGE OVERVIEW
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册