Buggy code:
public class Ion { static final Handler mainHandler = new Handler ( Looper . getMainLooper ( ) ) ; static int availableProcessors = Runtime . getRuntime ( ) . availableProcessors ( ) ; static ExecutorService ioExecutorService = Executors . newFixedThreadPool ( 4 ) ; static ExecutorService bitmapExecutorService = ( ( Ion . availableProcessors ) > 2 ) ? Executors . newFixedThreadPool ( ( ( Ion . availableProcessors ) - 1 ) ) : Executors . newFixedThreadPool ( 1 ) ; static HashMap < String , Ion > instances = new HashMap < String , Ion > ( ) ; public static LoadBuilder < Builders . Any . B > with ( Context context ) { } @ TargetApi ( VERSION_CODES . HONEYCOMB_MR2 ) public static LoadBuilder < Builders . Any . B > with ( Fragment fragment ) { } public static LoadBuilder < Builders . Any . B > with ( android . support . v4 . app . Fragment fragment ) { } public static Ion getDefault ( Context context ) { } public static Ion getInstance ( Context context , String name ) { } public static Builders . IV . F < ? extends Builders . IV . F < ? > > with ( ImageView imageView ) { } AsyncHttpClient httpClient ; ConscryptMiddleware conscryptMiddleware ; CookieMiddleware cookieMiddleware ; ResponseCacheMiddleware responseCache ; FileCache storeCache ; HttpLoader httpLoader ; ContentLoader contentLoader ; ResourceLoader resourceLoader ; AssetLoader assetLoader ; VideoLoader videoLoader ; PackageIconLoader packageIconLoader ; FileLoader fileLoader ; String logtag ; int logLevel ; Gson gson ; String userAgent ; ArrayList < Loader > loaders = new ArrayList < Loader > ( ) ; String name ; HashList < FutureCallback < BitmapInfo > > bitmapsPending = new HashList < FutureCallback < BitmapInfo > > ( ) ; Ion . Config config = new Ion . Config ( ) ; IonBitmapCache bitmapCache ; Context context ; IonImageViewRequestBuilder bitmapBuilder = new IonImageViewRequestBuilder ( this ) ; private Ion ( Context context , String name ) { } public static ExecutorService getBitmapLoadExecutorService ( ) { } public static ExecutorService getIoExecutorService ( ) { } public LoadBuilder < Builders . Any . B > build ( Context context ) { } public LoadBuilder < Builders . Any . B > build ( Fragment fragment ) { } public LoadBuilder < Builders . Any . B > build ( android . support . v4 . app . Fragment fragment ) { } public Builders . IV . F < ? extends Builders . IV . F < ? > > build ( ImageView imageView ) { } int groupCount ( Object group ) { } private static Comparator < DeferredLoadBitmap > DEFERRED_COMPARATOR = new Comparator < DeferredLoadBitmap > ( ) { @ Override public int compare ( DeferredLoadBitmap lhs , DeferredLoadBitmap rhs ) { } } ; private Runnable processDeferred = new Runnable ( ) { @ Override public void run ( ) { } } ; void processDeferred ( ) { } public void cancelAll ( Object group ) { } void addFutureInFlight ( Future future , Object group ) { } public void cancelAll ( ) { } public void cancelAll ( Context context ) { } public int getPendingRequestCount ( Object group ) { } public void dump ( ) { } public Context getContext ( ) { } static class FutureSet extends WeakHashMap < Future , Boolean > { } WeakHashMap < Object , Ion . FutureSet > inFlight = new WeakHashMap < Object , Ion . FutureSet > ( ) ; private void addCookieMiddleware ( ) { <START_BUG> httpClient . insertMiddleware ( ( cookieMiddleware = new CookieMiddleware ( context , name ) ) ) ; <END_BUG> } public FileCacheStore cache ( String key ) { } public FileCache getCache ( ) { } public FileCacheStore store ( String key ) { } public FileCache getStore ( ) { } public String getName ( ) { } public CookieMiddleware getCookieMiddleware ( ) { } public ConscryptMiddleware getConscryptMiddleware ( ) { } public AsyncHttpClient getHttpClient ( ) { } public AsyncServer getServer ( ) { } public class Config { public HttpLoader getHttpLoader ( ) { } public VideoLoader getVideoLoader ( ) { } public PackageIconLoader getPackageIconLoader ( ) { } public ContentLoader getContentLoader ( ) { } public FileLoader getFileLoader ( ) { } public ResponseCacheMiddleware getResponseCache ( ) { } public SSLContext createSSLContext ( String algorithm ) throws NoSuchAlgorithmException { } public synchronized Gson getGson ( ) { } public Ion . Config setLogging ( String logtag , int logLevel ) { } public void proxy ( String host , int port ) { } public void proxySecure ( String host , int port ) { } public void disableProxy ( ) { } public void disableSecureProxy ( ) { } public void setGson ( Gson gson ) { } AsyncHttpRequestFactory asyncHttpRequestFactory = new AsyncHttpRequestFactory ( ) { @ Override public AsyncHttpRequest createAsyncHttpRequest ( Uri uri , String method , Headers headers ) { } } ; public AsyncHttpRequestFactory getAsyncHttpRequestFactory ( ) { } public Ion . Config setAsyncHttpRequestFactory ( AsyncHttpRequestFactory asyncHttpRequestFactory ) { } public String userAgent ( ) { } public Ion . Config userAgent ( String userAgent ) { } public Ion . Config addLoader ( int index , Loader loader ) { } public Ion . Config insertLoader ( Loader loader ) { } public Ion . Config addLoader ( Loader loader ) { } public List < Loader > getLoaders ( ) { } } public Ion . Config configure ( ) { } public IonBitmapCache getBitmapCache ( ) { } }

Fix:
httpClient . insertMiddleware ( ( cookieMiddleware = new CookieMiddleware ( this ) ) ) ;