8287397: Print top-level exception when snippet fails to read file

Reviewed-by: jjg
This commit is contained in:
Anthony Vanelverdinghe 2022-12-08 10:19:39 +00:00 committed by Julian Waters
parent 073897c88b
commit 297bf6a596

View File

@ -229,7 +229,7 @@ public class SnippetTaglet extends BaseTaglet {
}
} catch (IOException | IllegalArgumentException e) { // TODO: test this when JDK-8276892 is integrated
// JavaFileManager.getFileForInput can throw IllegalArgumentException in certain cases
throw new BadSnippetException(a, "doclet.exception.read.file", v, e.getCause());
throw new BadSnippetException(a, "doclet.exception.read.file", v, e);
}
if (fileObject == null) {
@ -241,7 +241,7 @@ public class SnippetTaglet extends BaseTaglet {
externalContent = fileObject.getCharContent(true).toString();
} catch (IOException e) { // TODO: test this when JDK-8276892 is integrated
throw new BadSnippetException(a, "doclet.exception.read.file",
fileObject.getName(), e.getCause());
fileObject.getName(), e);
}
}