Update BulkProcessor.java

I suggest updating the BulkProcessor so that it prevents users from building a BulkProcessor with a null client.  If the client is null, then the class should throw an exception with a message that describes the cause of the exception.  Earlier today, when I passed a null client to the builder() method, later received an exception, and attempted to get the exception's message in my afterBulk() listener (e.g. e.getMessage()), the message was null.  It took me a while to pinpoint the cause of the problem.
This commit is contained in:
oyiadom 2015-07-27 17:46:59 -04:00
parent 93beea1f67
commit b09dce4e58
1 changed files with 4 additions and 0 deletions

View File

@ -145,6 +145,10 @@ public class BulkProcessor implements Closeable {
}
public static Builder builder(Client client, Listener listener) {
if (client == null) {
throw new Exception("The client you specified while building a BulkProcessor is null");
}
return new Builder(client, listener);
}