Skip to content

Commit 5e62e71

Browse files
committed
Checking null options argument, added Javadoc
1 parent 6495640 commit 5e62e71

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

library/src/main/java/com/loopj/android/http/AsyncHttpClient.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class AsyncHttpClient implements AsyncHttpClientInterface {
5252
private Class<? extends AsyncHttpRequestInterface> requestClass;
5353

5454
/**
55-
* Retrieves static instance of AsyncHttpClientInterface, if not yet configured, will configure it with default values
55+
* Retrieves static instance of AsyncHttpClientInterface,
56+
* if not yet configured, will configure it with default values
5657
*
5758
* @see com.loopj.android.http.interfaces.AsyncHttpClientOptionsInterface
5859
* @see com.loopj.android.http.impl.AsyncHttpClientOptions
@@ -61,6 +62,12 @@ public static AsyncHttpClientInterface getDefaultInstance() {
6162
return getDefaultInstance(new AsyncHttpClientOptions());
6263
}
6364

65+
/**
66+
* Retrieves static instance of AsyncHttpClientInterface,
67+
* if not yet configured, will configure it with provided options
68+
*
69+
* @see com.loopj.android.http.interfaces.AsyncHttpClientOptionsInterface
70+
*/
6471
public static AsyncHttpClientInterface getDefaultInstance(AsyncHttpClientOptionsInterface options) {
6572
if (DEFAULT_INSTANCE == null) {
6673
synchronized (AsyncHttpClient.class) {
@@ -72,7 +79,18 @@ public static AsyncHttpClientInterface getDefaultInstance(AsyncHttpClientOptions
7279
return DEFAULT_INSTANCE;
7380
}
7481

82+
/**
83+
* Default constructor, will configure AsyncHttpClientInterface
84+
* instance with provided options, or with default options,
85+
* if provided options argument is null
86+
*
87+
* @see com.loopj.android.http.interfaces.AsyncHttpClientOptionsInterface
88+
* @see com.loopj.android.http.impl.AsyncHttpClientOptions
89+
*/
7590
public AsyncHttpClient(AsyncHttpClientOptionsInterface options) {
91+
if (options == null) {
92+
options = new AsyncHttpClientOptions();
93+
}
7694
httpClient = options.getHttpClient();
7795
defaultRequestOptions = options.getDefaultRequestOptions();
7896
threadPool = options.getThreadPool();

0 commit comments

Comments
 (0)