[Demonstration 1]

[Buggy Method]
public static BufferedImage toBufferedImage(Image img) {
    if (img instanceof BufferedImage) {
        return (BufferedImage) img;
    }
    // Create a buffered image with transparency
    BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);
    // Draw the image on to the buffered image
    Graphics2D bGr = bimage.createGraphics();
    bGr.drawImage(img, 0, 0, null);
    bGr.dispose();
    // Return the buffered image
    return bimage;
}

[Buggy Hunk]
BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB);

[Patch]
BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_RGB);

[Demonstration 2]

[Buggy Method]
public void expand(final View v) {
    v.measure(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
    final int targetHeight = pxFromDp(this.getApplicationContext(), 75);
    v.getLayoutParams().height = 0;
    v.setVisibility(View.VISIBLE);
    Animation a = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            v.getLayoutParams().height = interpolatedTime == 1 ? LinearLayout.LayoutParams.WRAP_CONTENT : (int) (targetHeight * interpolatedTime);
            v.requestLayout();
        }

        @Override
        public boolean willChangeBounds() {
            return true;
        }
    };
    a.setDuration(500);
    v.startAnimation(a);
}

[Buggy Hunk]
v.getLayoutParams().height = interpolatedTime == 1 ? LinearLayout.LayoutParams.WRAP_CONTENT : (int)(targetHeight*interpolatedTime);

[Patch]
v.getLayoutParams().height = interpolatedTime == 1 ? targetHeight : (int)(targetHeight*interpolatedTime);

[Demonstration 3]

[Buggy Method]
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    onSetContentView(savedInstanceState);
    mWifiList = (ListView) findViewById(android.R.id.list);
    mProgressBar = (ProgressBar) findViewById(R.id.progressBar);
    Animation animation = new Animation() {

        @Override
        protected void applyTransformation(float interpolatedTime, Transformation t) {
            mProgressBar.setProgress((int) (100 * interpolatedTime));
        }
    };
    animation.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
        }

        @Override
        public void onAnimationEnd(Animation animation) {
        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            mWifiManager.startScan();
        }
    });
    animation.setDuration(5000);
    animation.setRepeatCount(Animation.INFINITE);
    animation.setInterpolator(new LinearInterpolator());
    mProgressBar.startAnimation(animation);
    mAdapter = new ArrayAdapter<>(this, R.layout.view_wifi, R.id.label_wifi);
    mWifiList.setAdapter(mAdapter);
    mWifiList.setOnItemClickListener((parent, view, position, id) -> {
        onAPSelected(mAdapter.getItem(position));
    });
    checkPermission();
    mWifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    mAdapter.addAll(mWifiManager.getScanResults().stream().map(AccessPoint::new).collect(Collectors.toList()));
}

[Buggy Hunk]
mAdapter.addAll(mWifiManager.getScanResults().stream().map(AccessPoint::new).collect(Collectors.toList()));

[Patch]
mAdapter.addAll(mapToAccessPoint(mWifiManager.getScanResults()));