Accepting request 963792 from Java:Factory

Fix an exception in javadoc generation

OBS-URL: https://build.opensuse.org/request/show/963792
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/java-17-openjdk?expand=0&rev=9
This commit is contained in:
Dominique Leuenberger 2022-03-22 18:39:42 +00:00 committed by Git OBS Bridge
commit 1fb31276c0
3 changed files with 88 additions and 0 deletions

78
JDK-8282944.patch Normal file
View File

@ -0,0 +1,78 @@
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
@@ -1015,6 +1015,9 @@ public class HtmlDocletWriter {
// @see reference label...
label = ref.subList(1, ref.size());
}
+ case ERRONEOUS -> {
+ return HtmlTree.SPAN(Text.of(resources.getText("doclet.tag.invalid_input", seeText)));
+ }
default ->
throw new IllegalStateException(ref.get(0).getKind().toString());
}
--- a/test/langtools/jdk/javadoc/doclet/testSeeTag/TestSeeTag.java
+++ b/test/langtools/jdk/javadoc/doclet/testSeeTag/TestSeeTag.java
@@ -23,15 +23,19 @@
/*
* @test
- * @bug 8017191 8182765 8200432 8239804 8250766 8262992
+ * @bug 8017191 8182765 8200432 8239804 8250766 8262992 8281944
* @summary Javadoc is confused by at-link to imported classes outside of the set of generated packages
- * @library ../../lib
+ * @library /tools/lib ../../lib
* @modules jdk.javadoc/jdk.javadoc.internal.tool
- * @build javadoc.tester.*
+ * @build toolbox.ToolBox javadoc.tester.*
* @run main TestSeeTag
*/
import javadoc.tester.JavadocTester;
+import toolbox.ToolBox;
+
+import java.io.IOException;
+import java.nio.file.Path;
public class TestSeeTag extends JavadocTester {
@@ -105,4 +109,40 @@ public class TestSeeTag extends JavadocTester {
</dd>
</dl>""");
}
+
+ ToolBox tb = new ToolBox();
+
+ @Test
+ public void testErroneous() throws IOException {
+ Path src = Path.of("erroneous", "src");
+ tb.writeJavaFiles(src, """
+ package erroneous;
+ /**
+ * Comment.
+ * @see <a href="
+ */
+ public class C {
+ private C() { }
+ }
+ """);
+
+ javadoc("-d", Path.of("erroneous", "api").toString(),
+ "-sourcepath", src.toString(),
+ "--no-platform-links",
+ "erroneous");
+ checkExit(Exit.ERROR);
+
+ checkOutput("erroneous/C.html", true,
+ """
+ <dl class="notes">
+ <dt>See Also:</dt>
+ <dd>
+ <ul class="see-list">
+ <li><span>invalid input: '&lt;a href="'</span></li>
+ </ul>
+ </dd>
+ </dl>
+ """);
+
+ }
}

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Mar 21 20:25:50 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* JDK-8282944.patch
+ Upstream fix for JDK-8281944: JavaDoc throws
java.lang.IllegalStateException: ERRONEOUS
-------------------------------------------------------------------
Sun Mar 20 01:08:12 UTC 2022 - Fridrich Strba <fstrba@suse.com>

View File

@ -211,6 +211,7 @@ Patch20: loadAssistiveTechnologies.patch
Patch200: ppc_stack_overflow_fix.patch
Patch201: fix_armv6_build.patch
#
Patch300: JDK-8282944.patch
Patch302: disable-doclint-by-default.patch
Patch303: alternative-tzdb_dat.patch
#
@ -492,6 +493,7 @@ rm -rvf src/java.desktop/share/native/liblcms/lcms2*
%patch201
%endif
%patch300 -p1
%patch302 -p1
%patch303 -p1