Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix enrich mediator failing continuously when a parse error happens" #2200

Merged
merged 1 commit into from
Jul 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -321,27 +321,24 @@ public JsonElement evaluateJson(MessageContext synCtx, SynapseLog synLog,
case EnrichMediator.INLINE: {
assert inlineOMNode != null
|| inlineKey != null : "inlineJSONNode or key shouldn't be null when type is INLINE";
try {
if (inlineOMNode instanceof OMText) {
object = JsonPath.parse(((OMTextImpl) inlineOMNode).getText()).json();
} else if (inlineKey != null && !inlineKey.trim().equals("")) {
Object inlineObj = synCtx.getEntry(inlineKey);
if ((inlineObj instanceof String) && !(((String) inlineObj).trim().equals(""))) {
object = JsonPath.parse(((String) inlineObj)).json();
} else {
synLog.error("Source failed to get inline JSON" + "inlineKey=" + inlineKey);
}
if (inlineOMNode instanceof OMText) {
object = JsonPath.parse(((OMTextImpl) inlineOMNode).getText()).json();
} else if (inlineKey != null && !inlineKey.trim().equals("")) {
Object inlineObj = synCtx.getEntry(inlineKey);
if ((inlineObj instanceof String) && !(((String) inlineObj).trim().equals(""))) {
object = JsonPath.parse(((String) inlineObj)).json();
} else {
synLog.error("Source failed to get inline JSON" + "inlineJSONNode=" + inlineOMNode + ", inlineKey="
+ inlineKey);
}
} finally {
// If the initialInlineOMNode is not null, it means that inline OM Node has been overridden with the
// inline string containing resolved dynamic values. Therefore, we should set the initial OM Node back
// which contains the original inline value
if (initialInlineOMNode != null) {
this.inlineOMNode = initialInlineOMNode;
synLog.error("Source failed to get inline JSON" + "inlineKey=" + inlineKey);
}
} else {
synLog.error("Source failed to get inline JSON" + "inlineJSONNode=" + inlineOMNode + ", inlineKey="
+ inlineKey);
}
// If the initialInlineOMNode is not null, it means that inline OM Node has been overridden with the
// inline string containing resolved dynamic values. Therefore, we should set the initial OM Node back
// which contains the original inline value
if (initialInlineOMNode != null) {
this.inlineOMNode = initialInlineOMNode;
}
break;
}
Expand Down
Loading