here-aaa-java-sdk icon indicating copy to clipboard operation
here-aaa-java-sdk copied to clipboard

Client.Builder class should use reasonable defaults, or fail-fast

Open kenmccracken opened this issue 6 years ago • 0 comments

Currently, the Client.Builder() class allows you to construct an instance without specifying, for example, a Serializer. The result is you get what appears to be a valid Client, but later when you send requests, they fail at the serialization step with a NullPointerException.

A Client instance that can be constructed, but cannot be used, is rather of pointless.

The solution should either

  1. Have the Client.Builder use reasonable defaults, such as apache HttpProvider, NoAuthorizer, and JacksonSerializer, when no override was specified.
  2. Have the Client.Builder.build() method validate not null with assertions that fail-fast and a clear null indicator.

kenmccracken avatar Nov 22 '19 18:11 kenmccracken