Skip to content

Commit

Permalink
Fix enrich mediator not failing when incorrect json is parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
DedunuKarunarathne committed Mar 27, 2024
1 parent 7b53750 commit 527d86b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,10 @@ private static String replaceValue(MessageContext messageContext, String text, b
}
// If the string is neither XML or JSON, it is considered a String and must be wrapped in double quotes
// If it is an empty string returned from a json-eval expression it must be wrapped in double quotes
if (isInline && ((value.isEmpty() && matchSeq.contains(EXPRESSION_JSON_EVAL))
|| (!isValidXML(value) && !isValidJson(value) && !isSurroundedByQuotes(surroundedString)))) {
if (isInline && (
(value.isEmpty() && matchSeq.contains(EXPRESSION_JSON_EVAL)) ||
(!isValidXML(value) && !isValidJson(value) && (value.isEmpty() || !isSurroundedByQuotes(surroundedString)))
)) {
value = "\"" + value + "\"";
}
text = text.replace(matchSeq, value);
Expand Down

0 comments on commit 527d86b

Please sign in to comment.