Quantcast

camel git commit: Camel-InfluxDB: Use ObjectHelper to check if something is null or not

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

camel git commit: Camel-InfluxDB: Use ObjectHelper to check if something is null or not

acosentino
Repository: camel
Updated Branches:
  refs/heads/master a811f4004 -> 879781312


Camel-InfluxDB: Use ObjectHelper to check if something is null or not


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/87978131
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/87978131
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/87978131

Branch: refs/heads/master
Commit: 879781312a4074db7a00d4ad8c0ea9004d47f76d
Parents: a811f40
Author: Andrea Cosentino <[hidden email]>
Authored: Wed Jan 11 13:37:44 2017 +0100
Committer: Andrea Cosentino <[hidden email]>
Committed: Wed Jan 11 13:38:15 2017 +0100

----------------------------------------------------------------------
 .../camel/component/influxdb/InfluxDbProducer.java       | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/87978131/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
----------------------------------------------------------------------
diff --git a/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java b/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
index 569784f..c33dddc 100644
--- a/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
+++ b/components/camel-influxdb/src/main/java/org/apache/camel/component/influxdb/InfluxDbProducer.java
@@ -41,11 +41,8 @@ public class InfluxDbProducer extends DefaultProducer {
 
     public InfluxDbProducer(InfluxDbEndpoint endpoint) {
         super(endpoint);
-        if (endpoint == null) {
-            throw new IllegalArgumentException("Can't create a producer when the endpoint is null");
-        }
 
-        if (endpoint.getInfluxDB() == null) {
+        if (ObjectHelper.isEmpty(endpoint.getInfluxDB())) {
             throw new IllegalArgumentException("Can't create a producer when the database connection is null");
         }
 
@@ -110,7 +107,7 @@ public class InfluxDbProducer extends DefaultProducer {
     private String calculateRetentionPolicy(Exchange exchange) {
         String retentionPolicy = exchange.getIn().getHeader(InfluxDbConstants.RETENTION_POLICY_HEADER, String.class);
 
-        if (retentionPolicy != null) {
+        if (ObjectHelper.isNotEmpty(retentionPolicy)) {
             return retentionPolicy;
         }
 
@@ -120,7 +117,7 @@ public class InfluxDbProducer extends DefaultProducer {
     private String calculateDatabaseName(Exchange exchange) {
         String dbName = exchange.getIn().getHeader(InfluxDbConstants.DBNAME_HEADER, String.class);
 
-        if (dbName != null) {
+        if (ObjectHelper.isNotEmpty(dbName)) {
             return dbName;
         }
 
@@ -130,7 +127,7 @@ public class InfluxDbProducer extends DefaultProducer {
     private String calculateQuery(Exchange exchange) {
         String query = exchange.getIn().getHeader(InfluxDbConstants.INFLUXDB_QUERY, String.class);
 
-        if (query != null) {
+        if (ObjectHelper.isNotEmpty(query)) {
             return query;
         } else {
             query = endpoint.getQuery();

Loading...