Skip to content

Commit

Permalink
Close input stream in FileWriter
Browse files Browse the repository at this point in the history
  • Loading branch information
vmishenev committed Jan 17, 2022
1 parent f7db503 commit 374bcba
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/base/src/main/kotlin/renderers/FileWriter.kt
Expand Up @@ -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")
)
}
}
Expand Down

0 comments on commit 374bcba

Please sign in to comment.