diff options
-rw-r--r-- | core/src/main/kotlin/DokkaVersion.kt | 5 | ||||
-rw-r--r-- | plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt | 8 |
2 files changed, 9 insertions, 4 deletions
diff --git a/core/src/main/kotlin/DokkaVersion.kt b/core/src/main/kotlin/DokkaVersion.kt index 410058f3..58dd0310 100644 --- a/core/src/main/kotlin/DokkaVersion.kt +++ b/core/src/main/kotlin/DokkaVersion.kt @@ -4,7 +4,8 @@ import java.util.* object DokkaVersion { val version: String by lazy { - val stream = javaClass.getResourceAsStream("/META-INF/dokka/dokka-version.properties") - Properties().apply { load(stream) }.getProperty("dokka-version") + javaClass.getResourceAsStream("/META-INF/dokka/dokka-version.properties").use { stream -> + Properties().apply { load(stream) }.getProperty("dokka-version") + } } } diff --git a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt index 91e8189b..1d721611 100644 --- a/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt +++ b/plugins/javadoc/src/main/kotlin/org/jetbrains/dokka/javadoc/renderer/KorteJavadocRenderer.kt @@ -189,8 +189,12 @@ class KorteJavadocRenderer(val context: DokkaContext, resourceDir: String) : private class ResourceTemplateProvider(val basePath: String) : TemplateProvider { override suspend fun get(template: String): String = - javaClass.classLoader.getResourceAsStream("$basePath/$template")?.bufferedReader()?.lines()?.toArray() - ?.joinToString("\n") ?: throw IllegalStateException("Template not found: $basePath/$template") + javaClass.classLoader.getResourceAsStream("$basePath/$template")?.use { stream -> + stream.bufferedReader() + .lines() + .toArray() + .joinToString("\n") + } ?: throw IllegalStateException("Template not found: $basePath/$template") } } |