From 696b29888fafe7e0eab01d583304c69d499d7efc Mon Sep 17 00:00:00 2001 From: Sanoj Punchihewa Date: Thu, 5 Dec 2024 09:07:33 +0530 Subject: [PATCH] Update data type handling in variable mediator --- .../org/apache/synapse/mediators/v2/VariableMediator.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/core/src/main/java/org/apache/synapse/mediators/v2/VariableMediator.java b/modules/core/src/main/java/org/apache/synapse/mediators/v2/VariableMediator.java index 997c7032fb..94b0ec8825 100644 --- a/modules/core/src/main/java/org/apache/synapse/mediators/v2/VariableMediator.java +++ b/modules/core/src/main/java/org/apache/synapse/mediators/v2/VariableMediator.java @@ -249,34 +249,42 @@ private Object convertExpressionResult(Object evaluatedValue, String type) { if (!(evaluatedValue instanceof Boolean)) { handleDataTypeException("BOOLEAN"); } + break; case DOUBLE: if (!(evaluatedValue instanceof Double)) { handleDataTypeException("DOUBLE"); } + break; case FLOAT: if (!(evaluatedValue instanceof Float)) { handleDataTypeException("FLOAT"); } + break; case INTEGER: if (!(evaluatedValue instanceof Integer)) { handleDataTypeException("INTEGER"); } + break; case LONG: if (!(evaluatedValue instanceof Long)) { handleDataTypeException("LONG"); } + break; case OM: if (!(evaluatedValue instanceof OMElement)) { handleDataTypeException("OM"); } + break; case SHORT: if (!(evaluatedValue instanceof Short)) { handleDataTypeException("SHORT"); } + break; case JSON: if (!(evaluatedValue instanceof JsonElement)) { handleDataTypeException("JSON"); } + break; default: } return evaluatedValue;