NOTICK - allow resolveJar errors to be quieter (#5898)

This commit is contained in:
Ryan Fowler 2020-01-27 14:08:08 +00:00 committed by Dan Newton
parent fa55b66c8d
commit d0faf4d7cb

View File

@ -164,7 +164,7 @@ class DriverDSLImpl(
private val bytemanJarPath: String? by lazy { private val bytemanJarPath: String? by lazy {
try { try {
resolveJar("org.jboss.byteman.agent.Transformer") resolveJar("org.jboss.byteman.agent.Transformer", verbose = false)
} catch (e: Exception) { } catch (e: Exception) {
null null
} }
@ -180,13 +180,16 @@ class DriverDSLImpl(
} }
} }
private fun resolveJar(className: String): String { private fun resolveJar(className: String, verbose: Boolean = true): String {
return try { return try {
val type = Class.forName(className) val type = Class.forName(className)
val src = type.protectionDomain.codeSource val src = type.protectionDomain.codeSource
src.location.toPath().toString() src.location.toPath().toString()
} catch (e: Exception) { } catch (e: Exception) {
log.warn("Unable to locate JAR for class given by `$className` on classpath: ${e.message}", e) when (verbose) {
true -> log.warn("Unable to locate JAR for class given by `$className` on classpath:", e)
false -> log.info("Unable to locate JAR for class given by `$className` on classpath")
}
throw e throw e
} }
} }