@@ -102,12 +102,12 @@ private FirebaseOptions(@NonNull final FirebaseOptions.Builder builder) {
102102 this .serviceAccountId = null ;
103103 }
104104 this .storageBucket = builder .storageBucket ;
105- this .httpTransport = checkNotNull ( builder .httpTransport ,
106- "FirebaseOptions must be initialized with a non-null HttpTransport." );
107- this .jsonFactory = checkNotNull ( builder .jsonFactory ,
108- "FirebaseOptions must be initialized with a non-null JsonFactory." );
109- this .threadManager = checkNotNull ( builder .threadManager ,
110- "FirebaseOptions must be initialized with a non-null ThreadManager." ) ;
105+ this .httpTransport = builder .httpTransport != null ? builder . httpTransport
106+ : ApiClientUtils . getDefaultTransport ( );
107+ this .jsonFactory = builder .jsonFactory != null ? builder . jsonFactory
108+ : ApiClientUtils . getDefaultJsonFactory ( );
109+ this .threadManager = builder .threadManager != null ? builder . threadManager
110+ : FirebaseThreadManagers . DEFAULT_THREAD_MANAGER ;
111111 checkArgument (builder .connectTimeout >= 0 );
112112 this .connectTimeout = builder .connectTimeout ;
113113 checkArgument (builder .readTimeout >= 0 );
@@ -255,9 +255,9 @@ public static final class Builder {
255255 private String serviceAccountId ;
256256 private Supplier <GoogleCredentials > credentialsSupplier ;
257257 private FirestoreOptions firestoreOptions ;
258- private HttpTransport httpTransport = ApiClientUtils . getDefaultTransport () ;
259- private JsonFactory jsonFactory = ApiClientUtils . getDefaultJsonFactory () ;
260- private ThreadManager threadManager = FirebaseThreadManagers . DEFAULT_THREAD_MANAGER ;
258+ private HttpTransport httpTransport ;
259+ private JsonFactory jsonFactory ;
260+ private ThreadManager threadManager ;
261261 private int connectTimeout ;
262262 private int readTimeout ;
263263
@@ -421,7 +421,8 @@ public Builder setServiceAccountId(@NonNull String serviceAccountId) {
421421 * @return This <code>Builder</code> instance is returned so subsequent calls can be chained.
422422 */
423423 public Builder setHttpTransport (HttpTransport httpTransport ) {
424- this .httpTransport = httpTransport ;
424+ this .httpTransport = checkNotNull (httpTransport ,
425+ "FirebaseOptions must be initialized with a non-null HttpTransport." );
425426 return this ;
426427 }
427428
@@ -433,7 +434,8 @@ public Builder setHttpTransport(HttpTransport httpTransport) {
433434 * @return This <code>Builder</code> instance is returned so subsequent calls can be chained.
434435 */
435436 public Builder setJsonFactory (JsonFactory jsonFactory ) {
436- this .jsonFactory = jsonFactory ;
437+ this .jsonFactory = checkNotNull (jsonFactory ,
438+ "FirebaseOptions must be initialized with a non-null JsonFactory." );
437439 return this ;
438440 }
439441
@@ -445,7 +447,8 @@ public Builder setJsonFactory(JsonFactory jsonFactory) {
445447 * @return This <code>Builder</code> instance is returned so subsequent calls can be chained.
446448 */
447449 public Builder setThreadManager (ThreadManager threadManager ) {
448- this .threadManager = threadManager ;
450+ this .threadManager = checkNotNull (threadManager ,
451+ "FirebaseOptions must be initialized with a non-null ThreadManager." );
449452 return this ;
450453 }
451454
0 commit comments