From f3be42e85bc4a5655cf7e76e9e12837323a215b4 Mon Sep 17 00:00:00 2001 From: Robert Poienar Date: Thu, 18 Jul 2024 08:33:32 +0300 Subject: [PATCH] Fixed java recorder problem --- .../FindObject/AltWaitForComponentProperty.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Bindings~/java/src/main/java/com/alttester/Commands/FindObject/AltWaitForComponentProperty.java b/Bindings~/java/src/main/java/com/alttester/Commands/FindObject/AltWaitForComponentProperty.java index a03789dc5..30d1435ff 100644 --- a/Bindings~/java/src/main/java/com/alttester/Commands/FindObject/AltWaitForComponentProperty.java +++ b/Bindings~/java/src/main/java/com/alttester/Commands/FindObject/AltWaitForComponentProperty.java @@ -23,7 +23,7 @@ import com.alttester.AltObject; import com.alttester.altTesterExceptions.WaitTimeOutException; import com.google.gson.Gson; -import com.google.gson.JsonElement; +import com.google.gson.JsonArray; /** * Wait until there are no longer any objects that respect the given criteria or @@ -76,11 +76,14 @@ public T Execute(Class returnType) { T propertyFound = altObject.getComponentProperty( getComponentPropertyParams, returnType); - if (!getPropertyAsString && propertyFound.equals(property)) return propertyFound; - String str = new Gson().toJsonTree(propertyFound).toString(); - jsonElementToString = str.contains("\"") ? str : "\"" + str + "\""; + if (!(propertyFound instanceof JsonArray)) { + String str = new Gson().toJsonTree(propertyFound).toString(); + jsonElementToString = str.contains("\"") ? str : "\"" + str + "\""; + } else { + jsonElementToString = propertyFound.toString(); + } if (getPropertyAsString && jsonElementToString.equals(property.toString())) return propertyFound;