From 96f1fa97232a4508c8483396ed74c8fc24bb3cb2 Mon Sep 17 00:00:00 2001 From: tpetillot Date: Fri, 5 Jul 2024 15:42:51 +0200 Subject: [PATCH] fix: package and simulation ID from system props, closes HYB-690 Motivation: Cast exception when setting package or simulation ID from system props. Modification: Use `UUID.fromString` when package or simulation ID is compute from system props. --- .../gatling/gradle/GatlingPluginExtension.groovy | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/main/groovy/io/gatling/gradle/GatlingPluginExtension.groovy b/src/main/groovy/io/gatling/gradle/GatlingPluginExtension.groovy index 2b496d0..0ec9565 100644 --- a/src/main/groovy/io/gatling/gradle/GatlingPluginExtension.groovy +++ b/src/main/groovy/io/gatling/gradle/GatlingPluginExtension.groovy @@ -135,7 +135,8 @@ class GatlingPluginExtension { @Input @Optional UUID getSimulationId() { - simulationId ?: System.getProperty(SIMULATION_ID_PROPERTY) ?: null + def sysProp = System.getProperty(SIMULATION_ID_PROPERTY) + return simulationId ?: (sysProp ? UUID.fromString(sysProp) : null) } @Input @@ -163,7 +164,8 @@ class GatlingPluginExtension { @Input @Optional UUID getPackageId() { - packageId ?: System.getProperty(PACKAGE_ID_PROPERTY) ?: null + def sysProp = System.getProperty(PACKAGE_ID_PROPERTY) + return packageId ?: (sysProp ? UUID.fromString(sysProp) : null) } @Input @@ -188,13 +190,7 @@ class GatlingPluginExtension { @Optional URL getControlPlaneUrl() { def sysProp = System.getProperty(CONTROL_PLANE_URL) - if (controlPlaneUrl != null) { - return controlPlaneUrl - } else if (sysProp != null && sysProp != ""){ - return new URL(sysProp) - } else { - return null - } + return controlPlaneUrl ?: (sysProp ? new URL(sysProp) : null) } @Input