Skip to content

Commit

Permalink
Fix invalid json error given for a nested Json message
Browse files Browse the repository at this point in the history
See wso2/streaming-integrator#228 for more details.
  • Loading branch information
dilini-muthumala committed Apr 23, 2021
1 parent de77cce commit 8bc53c2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
public class TemplateBuilder {

private static final Pattern DYNAMIC_PATTERN = Pattern.compile("(\\{\\{[^{}]*\\}\\})|[{}]");
private static final String SPLIT_PATTERN = "(\\{\\{|\\}\\})";
private static final String SPLIT_PATTERN = "(\\{.\\{|\\}.\\})";
private int[] positionArray;
private String[] splitTemplateArray;
private boolean isObjectMessage = false;
Expand Down Expand Up @@ -113,7 +113,7 @@ private String parseTextMessage(StreamDefinition streamDefinition, String templa
if (m.group(1) != null) {
int attrIndex = attributes.indexOf(m.group(1).replaceAll("\\p{Ps}", "").replaceAll("\\p{Pe}", ""));
if (attrIndex >= 0) {
m.appendReplacement(result, String.format("{{%s}}", attrIndex));
m.appendReplacement(result, String.format("{.{%s}.}", attrIndex));
} else {
throw new NoSuchAttributeException(String.format("Attribute : %s does not exist in %s.",
m.group(1), streamDefinition));
Expand Down

0 comments on commit 8bc53c2

Please sign in to comment.