Github user jhsenjaliya commented on a diff in the pull request:

    https://github.com/apache/eagle/pull/978#discussion_r165162632
  
    --- Diff: 
eagle-core/eagle-alert-parent/eagle-alert/alert-engine/src/main/java/org/apache/eagle/alert/engine/publisher/impl/AlertFilePublisher.java
 ---
    @@ -54,13 +54,26 @@ public void init(Config config, Publishment 
publishment, Map conf) throws Except
             int numOfFiles = DEFAULT_FILE_NUMBER;
             if (publishment.getProperties() != null) {
                 if 
(publishment.getProperties().containsKey(PublishConstants.FILE_NAME)) {
    -                fileName = (String) 
publishment.getProperties().get(PublishConstants.FILE_NAME);
    +                String property = (String) 
publishment.getProperties().get(PublishConstants.FILE_NAME);
    +                if (property != null && !"".equals(property)) {
    +                    fileName = property;
    +                }
                 }
                 if 
(publishment.getProperties().containsKey(PublishConstants.ROTATE_EVERY_KB)) {
    -                rotateSize = 
Integer.valueOf(publishment.getProperties().get(PublishConstants.ROTATE_EVERY_KB).toString());
    +                Object property = 
publishment.getProperties().get(PublishConstants.ROTATE_EVERY_KB);
    +                if (property instanceof Integer) {
    +                    rotateSize = (Integer)property;
    +                } else if (property instanceof String && 
!"".equals((String)property)) {
    --- End diff --
    
    could also check for null once its is instanceof string.


---

Reply via email to