KT-48620: Fix host name exception

This commit is contained in:
nataliya.valtman
2021-09-10 13:34:17 +03:00
parent 97e9e4efe7
commit b603f99863
2 changed files with 9 additions and 2 deletions
@@ -32,7 +32,14 @@ class KotlinBuildEsStatListener(val projectName: String, val reportStatistics: L
OperationCompletionListener, AutoCloseable, TaskExecutionListener {
val label by lazy { CompilerSystemProperties.KOTLIN_STAT_LABEl_PROPERTY.value }
val hostName by lazy { InetAddress.getLocalHost().hostName }
val hostName: String? by lazy {
try {
InetAddress.getLocalHost().hostName
} catch (_: Exception) {
//do nothing
null
}
}
override fun onFinish(event: FinishEvent?) {
if (event is TaskFinishEvent) {
@@ -20,7 +20,7 @@ data class CompileStatData(
val changes: List<String>,
val buildUuid: String = "Unset",
val kotlinVersion: String = "0.0.0",
val hostName: String = "Unset",
val hostName: String? = "Unset",
val timeInMillis: Long,
val nonIncrementalAttributes: Map<BuildAttribute, Int>,
val timeData: Map<BuildTime, Long>,