[Demonstration 1]

[Buggy Method]
public String format(Object o, String defaultIfNull) {
    if (o == null) {
        return defaultIfNull;
    }
    return format.format(o);
}

[Buggy Hunk]
return format.format(o);

[Patch]
return format.get().format(o);

[Demonstration 2]

[Buggy Method]
public static KeyPair load(String algorithm) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
    // Read Public Key.
    File filePublicKey = new File("public.key");
    FileInputStream fis = new FileInputStream("public.key");
    byte[] encodedPublicKey = new byte[(int) filePublicKey.length()];
    fis.read(encodedPublicKey);
    fis.close();
    // Read Private Key.
    File filePrivateKey = new File("private.key");
    fis = new FileInputStream("private.key");
    byte[] encodedPrivateKey = new byte[(int) filePrivateKey.length()];
    fis.read(encodedPrivateKey);
    fis.close();
    // Generate KeyPair.
    KeyFactory keyFactory = KeyFactory.getInstance(algorithm);
    X509EncodedKeySpec publicKeySpec = new X509EncodedKeySpec(encodedPublicKey);
    PublicKey publicKey = keyFactory.generatePublic(publicKeySpec);
    PKCS8EncodedKeySpec privateKeySpec = new PKCS8EncodedKeySpec(encodedPrivateKey);
    PrivateKey privateKey = keyFactory.generatePrivate(privateKeySpec);
    return new KeyPair(publicKey, privateKey);
}

[Buggy Hunk]
public static KeyPair load(String algorithm) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {

[Patch]
protected static KeyPair load(String algorithm) throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {

[Demonstration 3]

[Buggy Method]
private static void initAes() {
    //TODO: Init AES Keypair. Then encrypt with RSA key that keeped in Android Keystore System. Then save in Preferences with Base64.
    //TODO: Use this technic because AES is support encryption for a long length data more than 46. (If length more than 46. It will throw exception of RSA block size)
    try {
        String keyAes = md5Key(AES_KEY);
        if (!sharedPreferences.contains(keyAes)) {
            KeyGenerator keyGen = KeyGenerator.getInstance("AES");
            keyGen.init(256);
            SecretKey secretKey = keyGen.generateKey();
            Qlassified.Service.put(keyAes, Base64.encodeToString(secretKey.getEncoded(), Base64.DEFAULT));
        }
        String keyVector = md5Key(AES_VECTOR);
        if (!sharedPreferences.contains(AES_VECTOR)) {
            KeyGenerator keyGen = KeyGenerator.getInstance("AES");
            keyGen.init(128);
            SecretKey secretKey = keyGen.generateKey();
            Qlassified.Service.put(keyVector, Base64.encodeToString(secretKey.getEncoded(), Base64.DEFAULT));
        }
    } catch (Exception e) {
        e.printStackTrace();
        Logger.e(TAG, "initAes Exception: " + e.getMessage());
    }
}

[Buggy Hunk]
if (!sharedPreferences.contains(AES_VECTOR)) {

[Patch]
if (!sharedPreferences.contains(keyVector)) {