From 973f3377b5e3590fd0cb71b6fd8d00ffc5aa55b8 Mon Sep 17 00:00:00 2001 From: Shiwei Tian Date: Thu, 12 Oct 2017 11:08:02 +0800 Subject: modify deploy rule bug Issue-ID: HOLMES-44 Change-Id: Ib8ae03aee13144638c64978d97be2caff709c038 Signed-off-by: Shiwei Tian --- .../java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'rulemgt/src') diff --git a/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java index 856171b..5c2a428 100644 --- a/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java +++ b/rulemgt/src/main/java/org/onap/holmes/rulemgt/wrapper/RuleMgtWrapper.java @@ -73,10 +73,17 @@ public class RuleMgtWrapper { if (ruleTemp != null) { throw new CorrelationException("A rule with the same name already exists."); } + String packageName = deployRule2Engine(correlationRule); DmaapService.loopControlNames.put(packageName, ruleCreateRequest.getLoopControlName()); correlationRule.setPackageName(packageName); - CorrelationRule result = correlationRuleDao.saveRule(correlationRule); + CorrelationRule result = null; + try { + result = correlationRuleDao.saveRule(correlationRule); + } catch (CorrelationException e) { + engineWarpper.deleteRuleFromEngine(packageName); + throw new CorrelationException(e.getMessage()); + } RuleAddAndUpdateResponse ruleAddAndUpdateResponse = new RuleAddAndUpdateResponse(); ruleAddAndUpdateResponse.setRuleId(result.getRid()); return ruleAddAndUpdateResponse; -- cgit 1.2.3-korg