From 258dfe334d5002982e02db297151fdfb308274f7 Mon Sep 17 00:00:00 2001 From: Jan Nidzwetzki Date: Sat, 19 May 2018 10:45:58 +0200 Subject: [PATCH 1/2] Check required constructor parameters aren't null --- src/com/oanda/v20/Context.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/com/oanda/v20/Context.java b/src/com/oanda/v20/Context.java index 9456278..a0fb8fe 100644 --- a/src/com/oanda/v20/Context.java +++ b/src/com/oanda/v20/Context.java @@ -8,6 +8,7 @@ import java.util.Iterator; import java.util.Map; import java.util.HashMap; +import java.util.Objects; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; @@ -84,9 +85,11 @@ public Context( AcceptDatetimeFormat datetimeFormat, HttpClient httpClient ) { - this.uri = uri; - this.token = token; - this.httpClient = httpClient; + this.uri = Objects.requireNonNull(uri, "uri can not be null"); + this.token = Objects.requireNonNull(token, "token can not be null"); + this.httpClient = Objects.requireNonNull(httpClient, "httpClient can not be null"); + + Objects.requireNonNull(application, "application can not be null"); String extensions = null; From cbb3816ff7295ca50b9a6370de75ff7d7192f87b Mon Sep 17 00:00:00 2001 From: Jan Nidzwetzki Date: Sat, 19 May 2018 10:49:04 +0200 Subject: [PATCH 2/2] Check required constructor parameters aren't null --- src/com/oanda/v20/Context.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/com/oanda/v20/Context.java b/src/com/oanda/v20/Context.java index a0fb8fe..d86b042 100644 --- a/src/com/oanda/v20/Context.java +++ b/src/com/oanda/v20/Context.java @@ -90,6 +90,7 @@ public Context( this.httpClient = Objects.requireNonNull(httpClient, "httpClient can not be null"); Objects.requireNonNull(application, "application can not be null"); + Objects.requireNonNull(datetimeFormat, "datetimeFormat can not be null"); String extensions = null;