Skip to content

Commit

Permalink
Add null check to fix spotbugs warning. (#4998)
Browse files Browse the repository at this point in the history
  • Loading branch information
conniey authored Aug 14, 2019
1 parent 6768fc9 commit 58142d5
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ public static void main(String[] args) throws InterruptedException, IOException
// TimeoutException is thrown.
String firstPartition = client.getPartitionIds().blockFirst(OPERATION_TIMEOUT);

// This shouldn't happen, but if we are unable to get the partitions within the timeout period.
if (firstPartition == null) {
firstPartition = "0";
}

// Create a consumer.
// The "$Default" consumer group is created by default. This value can be found by going to the Event Hub
// instance you are connecting to, and selecting the "Consumer groups" page. EventPosition.latest() tells the
Expand Down

0 comments on commit 58142d5

Please sign in to comment.