8283648: Improve the snippet "file not found" message.

Reviewed-by: prappo
This commit is contained in:
Jonathan Gibbons 2022-03-25 21:20:02 +00:00
parent 36b36efa12
commit cb012a5b62
3 changed files with 9 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2010, 2022, 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
@ -52,6 +52,7 @@ Please file a bug against the javadoc tool via the Java bug reporting page\n\
(http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)\n\
for duplicates. Include error messages and the following diagnostic in your report. Thank you.
doclet.File_not_found=File not found: {0}
doclet.snippet_file_not_found=file not found on source path or snippet path: {0}
doclet.Copy_Overwrite_warning=File {0} not copied to {1} due to existing file with same name...
doclet.Copy_Ignored_warning=File {0} not copied: invalid name
doclet.Copy_snippet_to_clipboard=Copy

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, 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
@ -240,7 +240,7 @@ public class SnippetTaglet extends BaseTaglet {
if (fileObject == null) {
// i.e. the file does not exist
throw new BadSnippetException(a, "doclet.File_not_found", v);
throw new BadSnippetException(a, "doclet.snippet_file_not_found", v);
}
try {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2020, 2022, 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
@ -1079,11 +1079,11 @@ public class TestSnippetTag extends SnippetTester {
checkExit(Exit.ERROR);
checkOutput(Output.OUT, true,
"""
A.java:4: error: File not found: %s""".formatted(fileName));
A.java:4: error: file not found on source path or snippet path: %s""".formatted(fileName));
checkOutput("pkg/A.html", true, """
<details class="invalid-tag">
<summary>invalid @snippet</summary>
<pre>File not found: text.txt</pre>
<pre>file not found on source path or snippet path: text.txt</pre>
</details>
""");
checkNoCrashes();
@ -1140,7 +1140,7 @@ public class TestSnippetTag extends SnippetTester {
checkExit(Exit.ERROR);
checkOutput(Output.OUT, true,
"""
A.java:4: error: File not found: %s""".formatted(fileName));
A.java:4: error: file not found on source path or snippet path: %s""".formatted(fileName));
checkNoCrashes();
}
@ -1869,7 +1869,7 @@ public class TestSnippetTag extends SnippetTester {
checkExit(Exit.ERROR);
checkOutput(Output.OUT, true,
"""
A.java:4: error: File not found: %s""".formatted(fileName));
A.java:4: error: file not found on source path or snippet path: %s""".formatted(fileName));
checkNoCrashes();
}