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

Improve SPLIT_PATTERN to fix mapping errors with advance json objects #1820

Merged
merged 3 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions findbugs-exclude.xml
Original file line number Diff line number Diff line change
Expand Up @@ -310,5 +310,9 @@
<Class name="io.siddhi.core.stream.StreamJunction"/>
<Bug pattern="UPM_UNCALLED_PRIVATE_METHOD"/>
</Match>
<Match>
<Class name="io.siddhi.core.util.parser.helper.DefinitionParserHelper"/>
<Bug pattern="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED"/>
</Match>

</FindBugsFilter>
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,15 @@ public synchronized void shutdown() {
StringUtil.removeCRLFCharacters(siddhiAppContext.getName()) + "'.", t);
}
}
for (Trigger trigger : siddhiAppContext.getTriggerHolders()) {
try {
trigger.stop();
} catch (Throwable t) {
log.error(StringUtil.removeCRLFCharacters(ExceptionUtil.getMessageWithContext(t, siddhiAppContext)) +
" Error while stopping Trigger '" + StringUtil.removeCRLFCharacters(trigger.getId()) +
"' in Siddhi app '" + StringUtil.removeCRLFCharacters(siddhiAppContext.getName()) + "'.", t);
}
}
inputManager.disconnect();

Thread thread = new Thread(new Runnable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/
public class CronTrigger extends AbstractTrigger implements Job {

protected static final Logger LOG = LogManager.getLogger(CronTrigger.class);
private static final Logger log = LogManager.getLogger(CronTrigger.class);

private TriggerDefinition triggerDefinition;
private SiddhiAppContext siddhiAppContext;
Expand Down Expand Up @@ -100,9 +100,12 @@ public void stop() {
try {
if (scheduler != null) {
scheduler.deleteJob(new JobKey(jobName, jobGroup));
if (log.isDebugEnabled()) {
log.debug("Scheduler job: " + jobName + " Group: " + jobGroup + " has successfully stopped");
}
}
} catch (SchedulerException e) {
LOG.error(ExceptionUtil.getMessageWithContext(e, siddhiAppContext) +
log.error(ExceptionUtil.getMessageWithContext(e, siddhiAppContext) +
" Error while removing the cron trigger job '" + jobGroup + "':'" + jobName + "'", e);
}
}
Expand Down Expand Up @@ -134,7 +137,7 @@ private void scheduleCronJob(String cronString, String elementId) {
scheduler.scheduleJob(job, trigger);

} catch (SchedulerException e) {
LOG.error(ExceptionUtil.getMessageWithContext(e, siddhiAppContext) +
log.error(ExceptionUtil.getMessageWithContext(e, siddhiAppContext) +
" Error while instantiating quartz scheduler for trigger '" + triggerDefinition.getId() + "'.", e);
}
}
Expand All @@ -143,8 +146,8 @@ private void scheduleCronJob(String cronString, String elementId) {
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
JobDataMap dataMap = jobExecutionContext.getJobDetail().getJobDataMap();
CronTrigger cronEventTrigger = (CronTrigger) dataMap.get("trigger");
if (LOG.isDebugEnabled()) {
LOG.debug("Running Trigger Job '" + cronEventTrigger.getId() + "'");
if (log.isDebugEnabled()) {
log.debug("Running Trigger Job '" + cronEventTrigger.getId() + "'");
}
cronEventTrigger.sendEvent();
}
Expand Down
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