From 04280ce9b2322dd0f019bcd854db7e5aa0bb8ea7 Mon Sep 17 00:00:00 2001 From: Arunan Sugunakumar Date: Mon, 15 Jul 2024 13:57:37 +0530 Subject: [PATCH] Fix mapFunction constant with correct syntax --- .../mediator/datamapper/engine/core/mapper/MappingResource.java | 2 +- .../datamapper/engine/utils/DataMapperEngineConstants.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/core/mapper/MappingResource.java b/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/core/mapper/MappingResource.java index 085363219d..e1fe771906 100644 --- a/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/core/mapper/MappingResource.java +++ b/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/core/mapper/MappingResource.java @@ -149,7 +149,7 @@ private JSFunction createFunction(InputStream mappingConfig, String outputType) propertiesList.add(match.group(2) + "['" + match.group(3) + "']"); } - if (jsFunctionBody.contains(MAP_FUNCTION_NAME)) { + if (!jsFunctionBody.contains(fnName) && jsFunctionBody.contains(MAP_FUNCTION_NAME)) { fnName = MAP_FUNCTION; } diff --git a/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/utils/DataMapperEngineConstants.java b/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/utils/DataMapperEngineConstants.java index 76990c29ae..fd24c682dd 100644 --- a/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/utils/DataMapperEngineConstants.java +++ b/components/mediators/datamapper/org.wso2.carbon.mediator.datamapper.engine/src/main/java/org/wso2/carbon/mediator/datamapper/engine/utils/DataMapperEngineConstants.java @@ -57,7 +57,7 @@ public class DataMapperEngineConstants { public static final String FUNCTION_NAME_CONST_2 = "_S_"; public static final String INPUT_VARIABLE_IDENTIFIER = "inputVariables"; public static final String MAP_FUNCTION_NAME = "mapFunction"; - public static final String MAP_FUNCTION = "mapFunction(JSON.parse(" + INPUT_VARIABLE_IDENTIFIER + ")"; + public static final String MAP_FUNCTION = "mapFunction(JSON.parse(" + INPUT_VARIABLE_IDENTIFIER + "))"; public static final String NAME_SEPERATOR = "_Separat0r_"; public static final String ENCODE_CHAR_HYPHEN = "_EnC0DeCHaRHyPh3n_"; public static final String HYPHEN = "-";