[Demonstration 1]

[Buggy Method]
public static String decrypt(final String value, final Context c) {
    if (value == null)
        return null;
    try {
        final byte[] bytes = Base64.decode(value, Base64.DEFAULT);
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("PBEWithMD5AndDES");
        SecretKey key = keyFactory.generateSecret(new PBEKeySpec(String.valueOf(c.getPackageManager().getPackageInfo(c.getPackageName(), 0).firstInstallTime).toCharArray()));
        Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES");
        pbeCipher.init(Cipher.DECRYPT_MODE, key, new PBEParameterSpec(c.getPackageName().getBytes(Charset.forName("UTF-8")), 20));
        String decrypted = new String(pbeCipher.doFinal(bytes), Charset.forName("UTF-8"));
        if (decrypted.endsWith("#correct")) {
            return decrypted.substring(0, decrypted.lastIndexOf("#correct"));
        } else {
            // decryption failed
            return null;
        }
    } catch (Exception e) {
        return null;
    }
}

[Buggy Hunk]
public static String decrypt(final String value, final Context c) {

[Patch]
static String decrypt(final String value, final Context c) {

[Demonstration 2]

[Buggy Method]
private static BufferedImage decodeToImage(String imageString) {
    try {
        byte[] imageBytes = Base64.decode(imageString);
        ByteArrayInputStream bis = new ByteArrayInputStream(imageBytes);
        BufferedImage image = ImageIO.read(bis);
        bis.close();
        return image;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

[Buggy Hunk]
byte[] imageBytes = Base64.decode(imageString);

[Patch]
byte[] imageBytes = DatatypeConverter.parseBase64Binary(imageString);

[Demonstration 3]

[Buggy Method]
@GET
@Path("/reactionsForDrug")
public List<Reaction> getReactionsForDrug(@QueryParam("drug") String drug) {
    if (null == drug) {
        throw new WebApplicationException("drug query parameter must be present");
    }
    List<Reaction> reactions = DrugClient.INSTANCE.getTopReactionsByDrug(new Drug(drug), 10);
    return reactions;
}

[Buggy Hunk]
List<Reaction> reactions = DrugClient.INSTANCE.getTopReactionsByDrug(new Drug(drug), 10);

[Patch]
List<Reaction> reactions = INSTANCE.getTopReactionsByDrug(new Drug(drug), 10);