Skip to content

Commit 9178cfa

Browse files
committed
Throw IllegalArgumentException in DIO
1 parent 97e9c6e commit 9178cfa

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

library/src/com/nostra13/universalimageloader/core/DisplayImageOptions.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import android.graphics.BitmapFactory.Options;
2020
import android.os.Handler;
2121
import android.widget.ImageView;
22-
2322
import com.nostra13.universalimageloader.core.assist.ImageLoadingListener;
2423
import com.nostra13.universalimageloader.core.assist.ImageScaleType;
2524
import com.nostra13.universalimageloader.core.display.BitmapDisplayer;
@@ -44,7 +43,7 @@
4443
* <li>post-processor for image Bitmap (after caching in memory, before displaying)</li>
4544
* <li>how decoded {@link Bitmap} will be displayed</li>
4645
* </ul>
47-
*
46+
* <p/>
4847
* You can create instance:
4948
* <ul>
5049
* <li>with {@link Builder}:<br />
@@ -53,7 +52,7 @@
5352
* {@link Builder#showStubImage(int) showStubImage()}.{@link Builder#build() build()}</code><br />
5453
* </li>
5554
* <li>or by static method: {@link #createSimple()}</li> <br />
56-
*
55+
*
5756
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
5857
* @since 1.0.0
5958
*/
@@ -173,7 +172,7 @@ public Handler getHandler() {
173172

174173
/**
175174
* Builder for {@link DisplayImageOptions}
176-
*
175+
*
177176
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
178177
*/
179178
public static class Builder {
@@ -199,7 +198,7 @@ public Builder() {
199198

200199
/**
201200
* Stub image will be displayed in {@link android.widget.ImageView ImageView} during image loading
202-
*
201+
*
203202
* @param stubImageRes Stub image resource
204203
*/
205204
public Builder showStubImage(int stubImageRes) {
@@ -210,7 +209,7 @@ public Builder showStubImage(int stubImageRes) {
210209
/**
211210
* Incoming image will be displayed in {@link android.widget.ImageView ImageView} if empty URI (null or empty
212211
* string) will be passed to <b>ImageLoader.displayImage(...)</b> method.
213-
*
212+
*
214213
* @param imageRes Image resource
215214
*/
216215
public Builder showImageForEmptyUri(int imageRes) {
@@ -221,7 +220,7 @@ public Builder showImageForEmptyUri(int imageRes) {
221220
/**
222221
* Incoming image will be displayed in {@link android.widget.ImageView ImageView} if some error occurs during
223222
* requested image loading/decoding.
224-
*
223+
*
225224
* @param imageRes Image resource
226225
*/
227226
public Builder showImageOnFail(int imageRes) {
@@ -288,6 +287,7 @@ public Builder imageScaleType(ImageScaleType imageScaleType) {
288287

289288
/** Sets {@link Bitmap.Config bitmap config} for image decoding. Default value - {@link Bitmap.Config#ARGB_8888} */
290289
public Builder bitmapConfig(Bitmap.Config bitmapConfig) {
290+
if (bitmapConfig == null) throw new IllegalArgumentException("bitmapConfig can't be null");
291291
decodingOptions.inPreferredConfig = bitmapConfig;
292292
return this;
293293
}
@@ -301,6 +301,7 @@ public Builder bitmapConfig(Bitmap.Config bitmapConfig) {
301301
* option.
302302
*/
303303
public Builder decodingOptions(Options decodingOptions) {
304+
if (decodingOptions == null) throw new IllegalArgumentException("decodingOptions can't be null");
304305
this.decodingOptions = decodingOptions;
305306
return this;
306307
}
@@ -341,6 +342,7 @@ public Builder postProcessor(BitmapProcessor postProcessor) {
341342
* {@link DefaultConfigurationFactory#createBitmapDisplayer()}
342343
*/
343344
public Builder displayer(BitmapDisplayer displayer) {
345+
if (displayer == null) throw new IllegalArgumentException("displayer can't be null");
344346
this.displayer = displayer;
345347
return this;
346348
}
@@ -389,7 +391,7 @@ public DisplayImageOptions build() {
389391
* <li>{@link Bitmap.Config#ARGB_8888} bitmap config will be used for image decoding</li>
390392
* <li>{@link SimpleBitmapDisplayer} will be used for image displaying</li>
391393
* </ul>
392-
*
394+
* <p/>
393395
* These option are appropriate for simple single-use image (from drawables or from Internet) displaying.
394396
*/
395397
public static DisplayImageOptions createSimple() {

0 commit comments

Comments
 (0)