From b3427f476063b5ffc25fd4b7229d373535945ac2 Mon Sep 17 00:00:00 2001 From: xuelianhan007 Date: Mon, 23 Dec 2024 10:34:15 +0800 Subject: [PATCH] added checking for empty string --- .../operator/gateway/runner/DataTypeChecker.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/DataTypeChecker.java b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/DataTypeChecker.java index 858179fa..0025a63e 100644 --- a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/DataTypeChecker.java +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/DataTypeChecker.java @@ -61,9 +61,7 @@ default boolean checkExpectNotBlank(PathCheck pathCheck, Object variable) { default boolean checkExpectString(PathCheck pathCheck, Object variable) { Class dataType = whichDataTypeClass(variable); - if (Objects.isNull(variable) - || !String.class.equals(dataType) - || StringUtils.isBlank((String) variable)) { + if (Objects.isNull(variable) || !String.class.equals(dataType)) { throwException( pathCheck, String.format( @@ -72,6 +70,15 @@ default boolean checkExpectString(PathCheck pathCheck, Object variable) { variable, (dataType == null ? null : dataType.getSimpleName()), "String")); + } else if (StringUtils.isBlank((String) variable)) { + throwException( + pathCheck, + String.format( + EXPECT_INT_MSG, + extractCheckingPath(pathCheck.path()), + variable, + "empty string", + "Non Empty String")); } return true; }