diff options
author | Vadim Mishenev <vad-mishenev@yandex.ru> | 2022-01-18 13:18:12 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-18 13:18:12 +0300 |
commit | 2986661d784f1f37036c98f881ce8aa214c4f247 (patch) | |
tree | e74c6cb067cfcc10b932721cb06f29832a819e3f /plugins/base/src | |
parent | 62f2919f403a4617dfc622a260b8c4fc8fc13716 (diff) | |
download | dokka-2986661d784f1f37036c98f881ce8aa214c4f247.tar.gz dokka-2986661d784f1f37036c98f881ce8aa214c4f247.tar.bz2 dokka-2986661d784f1f37036c98f881ce8aa214c4f247.zip |
Close input stream in `FileWriter` (#2312)
Diffstat (limited to 'plugins/base/src')
-rw-r--r-- | plugins/base/src/main/kotlin/renderers/FileWriter.kt | 3 |
1 files changed, 2 insertions, 1 deletions
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") ) } } |