From 2986661d784f1f37036c98f881ce8aa214c4f247 Mon Sep 17 00:00:00 2001 From: Vadim Mishenev Date: Tue, 18 Jan 2022 13:18:12 +0300 Subject: Close input stream in `FileWriter` (#2312) --- plugins/base/src/main/kotlin/renderers/FileWriter.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins/base/src') diff --git a/plugins/base/src/main/kotlin/renderers/FileWriter.kt b/plugins/base/src/main/kotlin/renderers/FileWriter.kt index 9fcd3eb5..e195f23c 100644 --- a/plugins/base/src/main/kotlin/renderers/FileWriter.kt +++ b/plugins/base/src/main/kotlin/renderers/FileWriter.kt @@ -79,7 +79,8 @@ class FileWriter(val context: DokkaContext): OutputWriter { val filePath = file.toAbsolutePath().toString() withContext(Dispatchers.IO) { Paths.get(root.path, rebase(filePath)).toFile().writeBytes( - this@FileWriter.javaClass.getResourceAsStream(filePath).readBytes() + this@FileWriter.javaClass.getResourceAsStream(filePath).use { it?.readBytes() } + ?: throw IllegalStateException("Can not get a resource from $filePath") ) } } -- cgit