3030import io .serverlessworkflow .impl .schema .SchemaValidator ;
3131import io .serverlessworkflow .impl .schema .SchemaValidatorFactory ;
3232import java .net .URI ;
33+ import java .net .URISyntaxException ;
3334import java .time .Duration ;
3435import java .util .Map ;
3536import java .util .Optional ;
@@ -222,7 +223,7 @@ public static final String checkSecret(
222223 }
223224
224225 public static URI concatURI (URI base , String pathToAppend ) {
225- if (pathToAppend == null || pathToAppend . isEmpty ( )) {
226+ if (! isValid ( pathToAppend )) {
226227 return base ;
227228 }
228229
@@ -232,7 +233,7 @@ public static URI concatURI(URI base, String pathToAppend) {
232233 }
233234
234235 String basePath = base .getPath ();
235- if (basePath == null || basePath . isEmpty ( )) {
236+ if (! isValid ( basePath )) {
236237 basePath = "/" ;
237238 } else if (!basePath .endsWith ("/" )) {
238239 basePath = basePath + "/" ;
@@ -253,7 +254,7 @@ public static URI concatURI(URI base, String pathToAppend) {
253254
254255 try {
255256 return new URI (base .getScheme (), base .getAuthority (), finalPath , query , fragment );
256- } catch (Exception e ) {
257+ } catch (URISyntaxException e ) {
257258 throw new IllegalArgumentException (
258259 "Failed to build combined URI from base=" + base + " and path=" + pathToAppend , e );
259260 }
0 commit comments