diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/CustomJavaDocCommentBuilder.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/CustomJavaDocCommentBuilder.kt index 81e351485f..74296b5f87 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/CustomJavaDocCommentBuilder.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/CustomJavaDocCommentBuilder.kt @@ -45,16 +45,11 @@ class CustomJavaDocCommentBuilder( // builds Throws exception section val thrownException = traceTag.result.exceptionOrNull() - val exceptionThrow: String? = if (thrownException == null) { - traceTag.result.exceptionOrNull()?.let { it::class.qualifiedName } - } else { + if (thrownException != null) { val exceptionName = thrownException.javaClass.name val reason = findExceptionReason(currentMethod, thrownException) - "{@link $exceptionName} $reason" - } - if (exceptionThrow != null) { - customJavaDocComment.throwsException = exceptionThrow + customJavaDocComment.throwsException = "{@link $exceptionName} $reason" } // builds Iterates section diff --git a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt index 3a57924058..2c6533fc6a 100644 --- a/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt +++ b/utbot-summary/src/main/kotlin/org/utbot/summary/comment/SimpleCommentBuilder.kt @@ -57,12 +57,9 @@ open class SimpleCommentBuilder( root: SimpleSentenceBlock, currentMethod: SootMethod ) { - val thrownException = traceTag.result.exceptionOrNull() - if (thrownException == null) { - root.exceptionThrow = traceTag.result.exceptionOrNull()?.let { it::class.qualifiedName } - } else { - val exceptionName = thrownException.javaClass.simpleName - val reason = findExceptionReason(currentMethod, thrownException) + traceTag.result.exceptionOrNull()?.let { + val exceptionName = it.javaClass.simpleName + val reason = findExceptionReason(currentMethod, it) root.exceptionThrow = "$exceptionName $reason" } }