Skip to content

Commit

Permalink
Merge pull request #2170 from DedunuKarunarathne/fix-json-path
Browse files Browse the repository at this point in the history
Fix enrich mediator not failing when incorrect json is parsed
  • Loading branch information
DedunuKarunarathne authored Mar 28, 2024
2 parents 087a779 + 527d86b commit 916603f
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 916603f

Please sign in to comment.