[Demonstration 1]

[Buggy Method]
public void startService(final int target) {
    new Thread(new Runnable() {

        @Override
        public void run() {
            if (checkAccess()) {
                startActivity(new Intent(MainActivity.this, Info.class).putExtra("id", id).putExtra("driver", driv).putExtra("target", target));
            } else {
                Looper.prepare();
                accessError();
                Looper.loop();
            }
        }
    }).start();
}

[Buggy Hunk]
public void startService(final int target){

[Patch]
private void startService(final int target){

[Demonstration 2]

[Buggy Method]
private ZooKeeper createZooKeeper() throws IOException {
    ZooKeeper zk = new ZooKeeper(zkStr, sessionTimeout, this);
    for (Map.Entry<String, byte[]> authInfo : authInfos.entries()) {
        zk.addAuthInfo(authInfo.getKey(), authInfo.getValue());
    }
    return zk;
}

[Buggy Hunk]
ZooKeeper zk = new ZooKeeper(zkStr, sessionTimeout, this);

[Patch]
ZooKeeper zk = new ZooKeeper(zkStr, sessionTimeout, wrapWatcher(this));

[Demonstration 3]

[Buggy Method]
public synchronized String createTicket4User(Query dbQuery, InetAddress address, String userName, long expireTime) {
    ArrayList<Ticket> possibleList = getPossibleTicketsByAddress(address, userName);
    if (possibleList.isEmpty()) {
        System.out.println("Possible List Empty!");
        return null;
    }
    /* TODO: Check This on the Future
        if(possibleList.size() > 1) {
            System.out.println("More than one same-user");
            // TODO: take action here.
            return null;
        }*/
    Ticket ticket = possibleList.get(0);
    if (ticket.getTicket() == null) {
        ticket.setUserName(userName);
        ticket.setTicket(randomizer.generate8bytes());
        ticket.setExpireTime(expireTime);
        Collections.sort(ticketList);
    }
    JSONObject json = new JSONObject();
    json.put(JSON_TICKET, UnitConversion.ByteArray2Hex(ticket.getTicket()));
    json.put(JSON_TIME_TO_EXPIRE, ticket.getExpireTime());
    return json.toString();
}

[Buggy Hunk]
json.put(JSON_TIME_TO_EXPIRE, ticket.getExpireTime());

[Patch]
json.put(JSON_TIME_TO_EXPIRE, ticket.getExpireTime() - (new Date()).getTime()); // Recalculate to solve synchronization issues