eagle-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject incubator-eagle git commit: [MINOR] Fix bug for NPE caused by Kafka2TupleMetadata.properties and debug log checking
Date Wed, 14 Dec 2016 09:57:12 GMT
Repository: incubator-eagle
Updated Branches:
  refs/heads/master 7639ff223 -> 8734c37cb


[MINOR] Fix bug for NPE caused by Kafka2TupleMetadata.properties and debug log checking


Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/8734c37c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/8734c37c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/8734c37c

Branch: refs/heads/master
Commit: 8734c37cbaeb00120eba9127f92f7d44f0f1736e
Parents: 7639ff2
Author: Hao Chen <hao@apache.org>
Authored: Wed Dec 14 17:55:56 2016 +0800
Committer: Hao Chen <hao@apache.org>
Committed: Wed Dec 14 17:55:56 2016 +0800

----------------------------------------------------------------------
 .../eagle/alert/coordination/model/Kafka2TupleMetadata.java  | 4 +++-
 .../apache/eagle/app/messaging/MetricSchemaGenerator.java    | 8 +++++---
 2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8734c37c/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Kafka2TupleMetadata.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Kafka2TupleMetadata.java
b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Kafka2TupleMetadata.java
index e3ec774..eb9c18f 100644
--- a/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Kafka2TupleMetadata.java
+++ b/eagle-core/eagle-alert-parent/eagle-alert/alert-common/src/main/java/org/apache/eagle/alert/coordination/model/Kafka2TupleMetadata.java
@@ -18,6 +18,8 @@ package org.apache.eagle.alert.coordination.model;
 
 import com.google.common.base.Objects;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
+
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -27,7 +29,7 @@ import java.util.Map;
 public class Kafka2TupleMetadata {
     private String type;
     private String name; // data source name
-    private Map<String, String> properties;
+    private Map<String, String> properties = new HashMap<>();
     private String topic;
     private String schemeCls;
 

http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/8734c37c/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/messaging/MetricSchemaGenerator.java
----------------------------------------------------------------------
diff --git a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/messaging/MetricSchemaGenerator.java
b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/messaging/MetricSchemaGenerator.java
index 88fe338..bb29cea 100644
--- a/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/messaging/MetricSchemaGenerator.java
+++ b/eagle-core/eagle-app/eagle-app-base/src/main/java/org/apache/eagle/app/messaging/MetricSchemaGenerator.java
@@ -95,7 +95,7 @@ public class MetricSchemaGenerator extends BaseRichBolt {
 
     private void createMetricSchemaEntity(String metricName, MetricDefinition metricDefinition)
throws IOException, EagleServiceClientException {
         MetricSchemaEntity schemaEntity = new MetricSchemaEntity();
-        Map<String,String> schemaTags = new HashMap<>();
+        Map<String, String> schemaTags = new HashMap<>();
         schemaEntity.setTags(schemaTags);
         schemaTags.put(MetricSchemaEntity.METRIC_NAME_TAG, metricName);
         schemaTags.put(MetricSchemaEntity.METRIC_TYPE_TAG, metricDefinition.getMetricType());
@@ -104,8 +104,10 @@ public class MetricSchemaGenerator extends BaseRichBolt {
         schemaEntity.setMetricFields(Collections.singletonList(GENERIC_METRIC_VALUE_NAME));
         schemaEntity.setModifiedTimestamp(System.currentTimeMillis());
         GenericServiceAPIResponseEntity<String> response = this.client.create(Collections.singletonList(schemaEntity));
-        if (response.isSuccess() && LOG.isDebugEnabled()) {
-            LOG.debug("Created {}", schemaEntity);
+        if (response.isSuccess()) {
+            if (LOG.isDebugEnabled()) {
+                LOG.debug("Created {}", schemaEntity);
+            }
         } else {
             LOG.error("Failed to create {}", schemaEntity, response.getException());
             throw new IOException("Service error: " + response.getException());


Mime
View raw message