giladw commented on a change in pull request #238:
URL: https://github.com/apache/unomi/pull/238#discussion_r575822932



##########
File path: 
services/src/main/java/org/apache/unomi/services/impl/segments/SegmentServiceImpl.java
##########
@@ -233,14 +233,19 @@ public Segment getSegmentDefinition(String segmentId) {
     }
 
     public void setSegmentDefinition(Segment segment) {
-        ParserHelper.resolveConditionType(definitionsService, 
segment.getCondition());
-        if (segment.getMetadata().isEnabled() && 
!segment.getMetadata().isMissingPlugins()) {
-            updateAutoGeneratedRules(segment.getMetadata(), 
segment.getCondition());
+        try {
+            ParserHelper.resolveConditionType(definitionsService, 
segment.getCondition());
+            persistenceService.validateCondition(segment.getCondition(), new 
Profile());
+            if (segment.getMetadata().isEnabled() && 
!segment.getMetadata().isMissingPlugins()) {
+                updateAutoGeneratedRules(segment.getMetadata(), 
segment.getCondition());
+            }
+            // make sure we update the name and description metadata that 
might not match, so first we remove the entry from the map
+            persistenceService.save(segment, null, true);
+            updateExistingProfilesForSegment(segment);
+        } catch (Exception e) {

Review comment:
       ok, moving the log to the validation.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to