Skip to content

Commit

Permalink
Merge pull request #260 from jpbempel/jpbempel/fixNPEhandling
Browse files Browse the repository at this point in the history
Fix NPE handling
  • Loading branch information
jpbempel authored Feb 11, 2020
2 parents 06092cb + 48bbe41 commit 0e5c78d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main/java/org/datadog/jmxfetch/Instance.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,9 @@ public Instance(
this.minCollectionPeriod = (Integer) initConfig.get("min_collection_interval");
}

try {
this.emptyDefaultHostname = (Boolean) this.instanceMap.get("empty_default_hostname");
} catch (NullPointerException e) {
this.emptyDefaultHostname = false;
}
Object emptyDefaultHostnameObj = this.instanceMap.get("empty_default_hostname");
this.emptyDefaultHostname =
emptyDefaultHostnameObj != null ? (Boolean) emptyDefaultHostnameObj : false;

this.lastCollectionTime = 0;
this.lastRefreshTime = 0;
Expand Down

0 comments on commit 0e5c78d

Please sign in to comment.