Source:
Result hunt() throws IOException { if (shouldReadFromMemoryCache(data.memoryPolicy)) { Bitmap bitmap = cache.get(key); if (bitmap != null) { stats.dispatchCacheHit(); if (picasso.loggingEnabled) { log(OWNER_HUNTER, VERB_DECODED, data.logId(), "from cache"); } return new Result(bitmap, MEMORY); } } if (retryCount == 0) { data = data.newBuilder().networkPolicy(NetworkPolicy.OFFLINE).build(); } final AtomicReference<Result> resultReference = new AtomicReference<>(); final AtomicReference<Throwable> exceptionReference = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); try { requestHandler.load(picasso, data, new RequestHandler.Callback() { @Override public void onSuccess(@Nullable Result result) { resultReference.set(result); latch.countDown(); } @Override public void onError(Throwable t) { exceptionReference.set(t); latch.countDown(); } }); latch.await(); } catch (InterruptedException ie) { throw new InterruptedIOException(ie.getMessage()); } Throwable throwable = exceptionReference.get(); if (throwable != null) { if (throwable instanceof IOException) { throw (IOException) throwable; } if (throwable instanceof Error) { throw (Error) throwable; } if (throwable instanceof RuntimeException) { throw (RuntimeException) throwable; } throw new RuntimeException(throwable); } Result result = resultReference.get(); if (result.hasBitmap()) { if (picasso.loggingEnabled) { log(OWNER_HUNTER, VERB_DECODED, data.logId()); } Bitmap bitmap = result.getBitmap(); stats.dispatchBitmapDecoded(bitmap); List<Transformation> transformations = new ArrayList<>(); if (data.needsMatrixTransform() || result.getExifOrientation() != 0) { transformations.add(new MatrixTransformation(data)); } if (data.hasCustomTransformations()) { transformations.addAll(data.transformations); } result = applyTransformations(picasso, data, transformations, result); if (result.hasBitmap()) { stats.dispatchBitmapTransformed(result.getBitmap()); } } return result; }

Target:
Result hunt() throws IOException { if (shouldReadFromMemoryCache(data.memoryPolicy)) { Bitmap bitmap = cache.get(key); if (bitmap != null) { stats.dispatchCacheHit(); if (picasso.loggingEnabled) { log(OWNER_HUNTER, VERB_DECODED, data.logId(), "from cache"); } return new Result(bitmap, MEMORY); } } if (retryCount == 0) { data = data.newBuilder().networkPolicy(NetworkPolicy.OFFLINE).build(); } final AtomicReference<Result> resultReference = new AtomicReference<>(); final AtomicReference<Throwable> exceptionReference = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); try { requestHandler.load(picasso, data, new RequestHandler.Callback() { @Override public void onSuccess(@Nullable Result result) { resultReference.set(result); latch.countDown(); } @Override public void onError(@NonNull Throwable t) { exceptionReference.set(t); latch.countDown(); } }); latch.await(); } catch (InterruptedException ie) { InterruptedIOException interruptedIoException = new InterruptedIOException(); interruptedIoException.initCause(ie); throw interruptedIoException; } Throwable throwable = exceptionReference.get(); if (throwable != null) { if (throwable instanceof IOException) { throw (IOException) throwable; } if (throwable instanceof Error) { throw (Error) throwable; } if (throwable instanceof RuntimeException) { throw (RuntimeException) throwable; } throw new RuntimeException(throwable); } Result result = resultReference.get(); if (result.hasBitmap()) { if (picasso.loggingEnabled) { log(OWNER_HUNTER, VERB_DECODED, data.logId()); } Bitmap bitmap = result.getBitmap(); stats.dispatchBitmapDecoded(bitmap); List<Transformation> transformations = new ArrayList<>(data.transformations.size() + 1); if (data.needsMatrixTransform() || result.getExifRotation() != 0) { transformations.add(new MatrixTransformation(data)); } transformations.addAll(data.transformations); result = applyTransformations(picasso, data, transformations, result); if (result.hasBitmap()) { stats.dispatchBitmapTransformed(result.getBitmap()); } } return result; }