Skip to content

Commit c61f7b0

Browse files
authored
Use Preconditions.checkNotNull in FirebaseFunctions. (#475)
1 parent e934350 commit c61f7b0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ URL getURL(String function) {
194194
* @param origin The origin of the local emulator, such as "http://10.0.2.2:5005".
195195
*/
196196
public void useFunctionsEmulator(@NonNull String origin) {
197-
if (origin == null) {
198-
throw new IllegalArgumentException("origin cannot be null");
199-
}
197+
Preconditions.checkNotNull(origin, "origin cannot be null");
200198
urlFormat = origin + "/%2$s/%1$s/%3$s";
201199
}
202200

@@ -230,10 +228,11 @@ Task<HttpsCallableResult> call(String name, @Nullable Object data, HttpsCallOpti
230228
* @return A Task that will be completed when the request is complete.
231229
*/
232230
private Task<HttpsCallableResult> call(
233-
String name, @Nullable Object data, HttpsCallableContext context, HttpsCallOptions options) {
234-
if (name == null) {
235-
throw new IllegalArgumentException("name cannot be null");
236-
}
231+
@NonNull String name,
232+
@Nullable Object data,
233+
HttpsCallableContext context,
234+
HttpsCallOptions options) {
235+
Preconditions.checkNotNull(name, "name cannot be null");
237236
URL url = getURL(name);
238237

239238
Map<String, Object> body = new HashMap<>();

0 commit comments

Comments
 (0)