Kapt3: Fix stack trace reporting (KT-15433)

This commit is contained in:
Yan Zhulanow
2016-12-27 19:46:16 +03:00
committed by Yan Zhulanow
parent 8953e33417
commit aa84cc4911
@@ -19,6 +19,7 @@ package org.jetbrains.kotlin.kapt3.util
import org.jetbrains.kotlin.cli.common.messages.*
import java.io.ByteArrayOutputStream
import java.io.PrintWriter
import java.io.StringWriter
class KaptLogger(
val isVerbose: Boolean,
@@ -50,9 +51,9 @@ class KaptLogger(
fun exception(e: Throwable) {
val stacktrace = run {
val byteArrayOutputStream = ByteArrayOutputStream()
e.printStackTrace(PrintWriter(byteArrayOutputStream))
byteArrayOutputStream.toString("UTF-8")
val writer = StringWriter()
e.printStackTrace(PrintWriter(writer))
writer.toString()
}
messageCollector.report(CompilerMessageSeverity.EXCEPTION, PREFIX + "An exception occurred: " + stacktrace, CompilerMessageLocation.NO_LOCATION)
}