Skip to content

Commit f4f0602

Browse files
Check null parameters of client creation (#457)
1 parent 1f2ee35 commit f4f0602

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

client/src/main/java/dev/restate/client/base/BaseClient.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ public abstract class BaseClient implements Client {
4343
private final ClientRequestOptions baseOptions;
4444

4545
protected BaseClient(URI baseUri, SerdeFactory serdeFactory, ClientRequestOptions baseOptions) {
46-
this.baseUri = baseUri;
47-
this.serdeFactory = serdeFactory;
48-
this.baseOptions = baseOptions;
46+
this.baseUri = Objects.requireNonNull(baseUri, "Base uri cannot be null");
47+
if (!this.baseUri.isAbsolute()) {
48+
throw new IllegalArgumentException(
49+
"The base uri " + baseUri + " is not absolute. This is not supported.");
50+
}
51+
this.serdeFactory = serdeFactory == null ? SerdeFactory.NOOP : serdeFactory;
52+
this.baseOptions = baseOptions == null ? ClientRequestOptions.DEFAULT : baseOptions;
4953
}
5054

5155
@Override

0 commit comments

Comments
 (0)