This if condition might be better as: if (zkServer != null) - should be the same result since that will only be non-null if the client string was not provided, but then it also is a bit safer in terms of not calling the getClientPort() method on it unless it's not null (if any of this logic were to change in the future).