[Demonstration 1]

[Buggy Method]
public void setUserName(String uname) {
    output.printUTF(uname);
}

[Buggy Hunk]
output.printUTF(uname);

[Patch]
output.println(uname);

[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 byte[] createAuthBlob() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {
    byte[] data = null;
    if (this.parent.getChallengeData() != null) {
        String encpass = new String(this.parent.encryptPassword());
        char[] buffer = encpass.toCharArray();
        byte[][] keys = KeyStream.GenerateKeys(buffer, this.parent.getChallengeData());
        this.inputKey = new KeyStream(keys[2], keys[3]);
        this.outputKey = new KeyStream(keys[0], keys[1]);
        this.parent.reader.setKey(this.inputKey);
        // TODO kkk need rebuild
        ByteArrayOutputStream b = new ByteArrayOutputStream();
        b.write(new byte[] { 0, 0, 0, 0 });
        b.write(this.phoneNumber.getBytes(WhatsAppBase.SYSEncoding));
        b.write(this.parent.getChallengeData());
        b.write(Long.toString(System.currentTimeMillis() / 1000L).getBytes(WhatsAppBase.SYSEncoding));
        data = b.toByteArray();
        this.parent.setChallengeData(null);
        data = this.outputKey.EncodeMessage(data, 0, 4, data.length - 4);
        this.parent.writer.setKey(this.outputKey);
    }
    return data;
}

[Buggy Hunk]
private byte[] createAuthBlob() throws IOException, NoSuchAlgorithmException, InvalidKeySpecException {

[Patch]
private byte[] createAuthBlob() throws IOException {