From 28b3577b0fe0839be85975c96b7dd03f7eb38e40 Mon Sep 17 00:00:00 2001 From: Francisco Javier Tirado Sarti Date: Wed, 19 Jul 2023 13:47:03 +0200 Subject: [PATCH] [KOGITO-9584] Michaels comment --- .../workflow/io/URIContentLoaderFactory.java | 11 ++++------- .../serverless/workflow/parser/schema/RefSchemas.java | 5 ++++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/URIContentLoaderFactory.java b/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/URIContentLoaderFactory.java index 7013f0a93cd..57662561be9 100644 --- a/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/URIContentLoaderFactory.java +++ b/kogito-serverless-workflow/kogito-serverless-workflow-runtime/src/main/java/org/kie/kogito/serverless/workflow/io/URIContentLoaderFactory.java @@ -68,7 +68,7 @@ public static class Builder { private URIContentLoader fallback; private Workflow workflow; private String authRef; - private URI baseURI; + private String baseURI; private Builder(URI uri) { this.uri = uri; @@ -95,10 +95,7 @@ public Builder withAuthRef(String authRef) { } public Builder withBaseURI(String baseURI) { - if (baseURI != null) { - int lastIndexOf = baseURI.lastIndexOf('/'); - this.baseURI = URI.create(lastIndexOf != -1 ? baseURI.substring(0, lastIndexOf) : baseURI); - } + this.baseURI = baseURI; return this; } @@ -122,8 +119,8 @@ public URIContentLoader build() { } } - private static URI compoundURI(URI baseURI, URI uri) { - return URI.create(baseURI.toString() + "/" + uri.toString()); + private static URI compoundURI(String baseURI, URI uri) { + return URI.create(baseURI + "/" + uri.toString()); } private URIContentLoaderFactory() { 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 04291d6ce43..f68072a5978 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 @@ -48,7 +48,10 @@ public static Map get() { } public static void baseURI(String baseURI) { - threadInfo.get().baseURI = baseURI; + if (baseURI != null) { + int lastIndexOf = baseURI.lastIndexOf('/'); + threadInfo.get().baseURI = lastIndexOf != -1 ? baseURI.substring(0, lastIndexOf) : baseURI; + } } public static String getBaseURI() {