From abb367434f7a9dcb5489c7c8a363d9ecdcfbc5eb Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti Date: Mon, 17 Jul 2023 17:31:53 +0200 Subject: [PATCH] [KOGITO-9584] Review comments and sonar warnings --- .../workflow/parser/schema/JsonSchemaImpl.java | 5 +++++ .../serverless/workflow/parser/schema/RefSchemas.java | 10 +++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/JsonSchemaImpl.java b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/JsonSchemaImpl.java index ee3deecc6ec..abda815211d 100644 --- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/JsonSchemaImpl.java +++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/JsonSchemaImpl.java @@ -27,6 +27,8 @@ import org.eclipse.microprofile.openapi.models.media.Schema; import org.kie.kogito.jackson.utils.ObjectMapperFactory; import org.kie.kogito.serverless.workflow.io.URIContentLoaderFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; @@ -44,6 +46,8 @@ @JsonInclude(JsonInclude.Include.NON_NULL) public class JsonSchemaImpl extends SchemaImpl { + private static final Logger logger = LoggerFactory.getLogger(JsonSchemaImpl.class); + @JsonSetter("$ref") @Override public void setRef(String ref) { @@ -63,6 +67,7 @@ public void setRef(String ref) { ref = OpenApiConstants.REF_PREFIX_SCHEMA + key; } catch (URISyntaxException | IOException e) { // if not a valid uri, let super handle it + logger.info("Error loading ref {}", ref, e); } } super.setRef(ref); diff --git a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/RefSchemas.java b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/RefSchemas.java index 3c3571ab0ce..3020acf1562 100644 --- a/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/RefSchemas.java +++ b/quarkus/extensions/kogito-quarkus-serverless-workflow-extension/kogito-quarkus-serverless-workflow-deployment/src/main/java/org/kie/kogito/serverless/workflow/parser/schema/RefSchemas.java @@ -27,11 +27,11 @@ private RefSchemas() { } private static class ThreadInfo { - public int counter; - public String id; - public Map map = new HashMap<>(); + private final String id; + private final Map map = new HashMap<>(); + private int counter; - public ThreadInfo(String id) { + private ThreadInfo(String id) { this.id = id; } } @@ -52,6 +52,6 @@ public static String getKey() { } public static void reset() { - threadInfo.set(null); + threadInfo.remove(); } }