[Demonstration 1]

[Buggy Method]
public static String addNewUser(ChatUser user, Session session) throws NoSuchAlgorithmException, IOException {
    ChatUserDAO dao = new ChatUserDAO();
    if (user.getId() == null) {
        ChatDBUsers loginDetails = dao.getLoginDetails(user.getEmail(), session);
        if (loginDetails == null) {
            loginDetails = dao.getLoginDetailsByUid(user.getUid(), session);
            if (loginDetails == null) {
                ChatDBUsers chatDBUsers = ChatBusinessConverters.getChatDBUser(user, session);
                setImage(user, chatDBUsers);
                session.persist(chatDBUsers);
                setDepartment(user, session, chatDBUsers);
            } else {
                return ERROR_USER_ID_EXISTS;
            }
        } else {
            return ERROR_EMAIL_EXISTS;
        }
    } else {
        ChatDBUsers registeredUser = new ChatUserDAO().getLoginDetails(user.getId(), session);
        if (StringUtils.isBlank(user.getPassword()) || ChatEncryptionUtil.validatePassword(user, registeredUser)) {
            ChatBusinessConverters.setUser(user, registeredUser);
            setImage(user, registeredUser);
            // setDepartment(user, session, registeredUser);
        } else {
            return ERROR_INCORRECT_OLD_PASSWORD;
        }
    }
    return RESPONSE_OK;
}

[Buggy Hunk]
if (StringUtils.isBlank(user.getPassword()) || ChatEncryptionUtil.validatePassword(user, registeredUser)) {

[Patch]
if (StringUtils.isBlank(user.getPassword()) || ChatEncryptionUtil.validatePassword(user.getOldPassword(), registeredUser)) {

[Demonstration 2]

[Buggy Method]
private void readFileAsList(Context context) {
    String line;
    readFileFromRawDirectory(context.getResources().getIdentifier(fileId, "raw", context.getPackageName()));
    InputStream inputStream = context.getResources().openRawResource(context.getResources().getIdentifier(fileId, "raw", context.getPackageName()));
    InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8"));
    contentText = "";
    InterviewQuestionModel interviewQuestionModel = null;
    Scanner sc = new Scanner(inputStream, "UTF-8");
    while (sc.hasNext()) {
        line = sc.nextLine();
        Log.d(TAG, "Read Line : " + line);
        if (line.contains("<question>")) {
            if (interviewQuestionModel != null) {
                contentArrayList.add(interviewQuestionModel);
                Log.d(TAG, "Question : " + interviewQuestionModel.getQuestion());
            }
            Log.d(TAG, "Forming question");
            interviewQuestionModel = new InterviewQuestionModel();
            String question = "";
            while (!(line = sc.nextLine()).equals("</>")) {
                question += line + "\n";
            }
            if (sc.hasNext())
                line = sc.nextLine();
            interviewQuestionModel.setQuestion(question);
        }
        if (line.contains("<code>")) {
            String code = "";
            while (!(line = sc.nextLine()).equals("</>")) {
                code += line + "\n";
            }
            if (sc.hasNext())
                line = sc.nextLine();
            if (interviewQuestionModel != null)
                interviewQuestionModel.setCode(code);
        }
        if (line.contains("<option>")) {
            while (sc.hasNext() && !(line = sc.nextLine()).equals("</>")) {
                if (line.startsWith("a)")) {
                    String optionA = line.split(Pattern.quote("a)"))[1];
                    interviewQuestionModel.setOptionModels(new ArrayList<OptionModel>());
                    interviewQuestionModel.getOptionModels().add(new OptionModel(1, optionA));
                    interviewQuestionModel.setTypeOfQuestion(InterviewQuestionConstants.TYPE_TRUE_FALSE);
                    Log.d(TAG, "Options : " + optionA);
                    if (sc.hasNext())
                        line = sc.nextLine();
                }
                if (line.startsWith("b)")) {
                    String optionB = line.split(Pattern.quote("b)"))[1];
                    if (sc.hasNext())
                        line = sc.nextLine();
                    interviewQuestionModel.getOptionModels().add(new OptionModel(2, optionB));
                    interviewQuestionModel.setTypeOfQuestion(InterviewQuestionConstants.TYPE_TRUE_FALSE);
                    Log.d(TAG, "Options : " + optionB);
                }
                if (line.startsWith("c)")) {
                    String optionC = line.split(Pattern.quote("c)"))[1];
                    if (sc.hasNext())
                        line = sc.nextLine();
                    interviewQuestionModel.getOptionModels().add(new OptionModel(3, optionC));
                    interviewQuestionModel.setTypeOfQuestion(InterviewQuestionConstants.TYPE_SINGLE_RIGHT);
                    Log.d(TAG, "Options : " + optionC);
                }
                if (line.startsWith("d)")) {
                    String optionD = line.split(Pattern.quote("d)"))[1];
                    interviewQuestionModel.getOptionModels().add(new OptionModel(4, optionD));
                    interviewQuestionModel.setTypeOfQuestion(InterviewQuestionConstants.TYPE_SINGLE_RIGHT);
                    Log.d(TAG, "Options : " + optionD);
                }
            }
            if (sc.hasNext())
                line = sc.nextLine();
        }
        if (line.startsWith("Answer:")) {
            String answer = line.split(":")[1].trim();
            switch(answer) {
                case "a":
                    interviewQuestionModel.setCorrectOption(1);
                    break;
                case "b":
                    interviewQuestionModel.setCorrectOption(2);
                    break;
                case "c":
                    interviewQuestionModel.setCorrectOption(3);
                    break;
                case "d":
                    interviewQuestionModel.setCorrectOption(4);
                    break;
            }
        }
        if (line.contains("<output>")) {
            String output = "";
            while (sc.hasNext() && !(line = sc.nextLine()).equals("</>")) {
                output += line + "\n";
            }
            if (sc.hasNext())
                line = sc.nextLine();
            if (interviewQuestionModel != null)
                interviewQuestionModel.setOutput(output);
        }
        if (line.contains("<Explanation>")) {
            String explanation = "";
            while (sc.hasNext() && !(line = sc.nextLine()).equals("</>")) {
                explanation += line + "\n";
            }
            if (sc.hasNext())
                line = sc.nextLine();
            if (interviewQuestionModel != null)
                interviewQuestionModel.setOutput(explanation);
        }
    }
    if (interviewQuestionModel != null) {
        contentArrayList.add(interviewQuestionModel);
        Log.d(TAG, "Question : " + interviewQuestionModel.getQuestion());
    }
}

[Buggy Hunk]
interviewQuestionModel.setOutput(explanation);

[Patch]
interviewQuestionModel.setExplanation(explanation);

[Demonstration 3]

[Buggy Method]
void createImageArrays() {
    Bitmap bMap = BitmapFactory.decodeResource(mContext.getResources(), imageId);
    Bitmap bMapScaled = Bitmap.createScaledBitmap(bMap, screenWidth, screenHeight, true);
    bitmapsArray = new Bitmap[rows][cols];
    for (int i = 0; i < rows; i++) {
        for (int j = 0; j < cols; j++) {
            bitmapsArray[i][j] = Bitmap.createBitmap(bMapScaled, (int) (i * pieceWidth), (int) (j * pieceHeight), (int) pieceWidth, (int) pieceHeight);
        }
    }
}

[Buggy Hunk]
bitmapsArray[i][j] = Bitmap.createBitmap(bMapScaled, (int) (i * pieceWidth), (int) (j * pieceHeight), (int) pieceWidth, (int) pieceHeight);

[Patch]
bitmapsArray[i][j] = Bitmap.createBitmap(bMapScaled, (int) (j * pieceWidth), (int) (i * pieceHeight), (int) pieceWidth, (int) pieceHeight);