[Demonstration 1]

[Buggy Method]
public synchronized void offerEncoder(byte[] input) {
    try {
        ByteBuffer[] inputBuffers = mediaCodec.getInputBuffers();
        ByteBuffer[] outputBuffers = mediaCodec.getOutputBuffers();
        int inputBufferIndex = mediaCodec.dequeueInputBuffer(-1);
        if (inputBufferIndex >= 0) {
            ByteBuffer inputBuffer = inputBuffers[inputBufferIndex];
            inputBuffer.clear();
            inputBuffer.put(input);
            mediaCodec.queueInputBuffer(inputBufferIndex, 0, input.length, System.currentTimeMillis() * 1000, 0);
        }
        MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo();
        int outputBufferIndex = mediaCodec.dequeueOutputBuffer(bufferInfo, 0);
        while (outputBufferIndex >= 0) {
            ByteBuffer outputBuffer = outputBuffers[outputBufferIndex];
            byte[] outData = new byte[bufferInfo.size];
            outputBuffer.position(bufferInfo.offset);
            outputBuffer.get(outData);
            handler.addAudioFrame(outData);
            mediaCodec.releaseOutputBuffer(outputBufferIndex, false);
            outputBufferIndex = mediaCodec.dequeueOutputBuffer(bufferInfo, 0);
        }
    } catch (Throwable t) {
        t.printStackTrace();
    }
}

[Buggy Hunk]
t.printStackTrace();

[Patch]
Log.e(AudioEncoder.class.getName(),"Error Occured : ",t);

[Demonstration 2]

[Buggy Method]
private void sendZoneBlink(String tag, String zone) {
    StringBuffer sb = new StringBuffer();
    Scanner in;
    in = new Scanner(System.in);
    Random r = new Random();
    Integer posx = 0, posy = 0;
    String serialNumber = "";
    String lr = "LR5";
    if (tag == null) {
        System.out.print(cu.ANSI_BLACK + "\nenter a serialNumber[" + cu.ANSI_GREEN + lastSerialNumber + cu.ANSI_BLACK + "]:");
        String tagIn = in.nextLine();
        if (tagIn == "") {
            tagIn = lastSerialNumber;
        } else {
            tagIn = "000000000000000000000" + tagIn;
        }
        tag = tagIn.substring(tagIn.length() - 21, tagIn.length());
        lastSerialNumber = tag;
    }
    if (zone == "Stockroom") {
        posx = 37;
        posy = 44;
    }
    if (zone == "Salesfloor") {
        posx = 59;
        posy = 25;
    }
    if (zone == "POS") {
        posx = 18;
        posy = 12;
    }
    if (zone == "Entrance") {
        posx = 7;
        posy = 7;
    }
    sb.append("EPOCH,NOW\n");
    sb.append("DELT,REL\n");
    sb.append("\n");
    sb.append("CS,-118.443969,34.048092,0.0,20.0,ft\n");
    sb.append("LOC, 00:00:00," + tag + "," + posx + "," + posy + ",0," + lr + ",x3ed9371\n");
    System.out.println("serialNumber: " + cu.ANSI_BLUE + tag + cu.ANSI_BLACK + "");
    System.out.println("   locationX: " + cu.ANSI_BLUE + posx + cu.ANSI_BLACK + "");
    System.out.println("   locationY: " + cu.ANSI_BLUE + posy + cu.ANSI_BLACK + "");
    DBObject prevThing = cu.getThing(tag);
    OutputStream output = new OutputStream() {

        private StringBuilder string = new StringBuilder();

        @Override
        public void write(int b) throws IOException {
            this.string.append((char) b);
        }

        public String toString() {
            return this.string.toString();
        }
    };
    ALEXMLMessage aleXmlMessage;
    try {
        aleXmlMessage = new ALEXMLMessage();
        aleXmlMessage.run(new ByteArrayInputStream(sb.toString().getBytes()), (OutputStream) output);
        //aleXmlMessage.run( System.in, System.out );
        System.out.println("AleXML generated a " + cu.ANSI_BLUE + output.toString().length() + cu.ANSI_BLACK + " bytes message");
        String[] args = { "" };
        ALEPost alep = new ALEPost(args);
        alep.run(new ByteArrayInputStream(output.toString().getBytes()));
        cu.sleep(1000);
        //cu.displayThing(prevThing);
        //cu.displayThing(cu.getThing(tag));
        cu.diffThings(cu.getThing(tag), prevThing);
    } catch (IOException e) {
        e.printStackTrace();
    } catch (ParseException e) {
        e.printStackTrace();
    } catch (org.apache.commons.cli.ParseException e) {
        e.printStackTrace();
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
}

[Buggy Hunk]
if (tagIn == "") {

[Patch]
if (tagIn.equals("")) {

[Demonstration 3]

[Buggy Method]
@RequestMapping(value = "{entityType}/{entityId}/document/{documentId}", method = RequestMethod.DELETE)
@Transactional
public void delete(@PathVariable String entityType, @PathVariable long entityId, @PathVariable long documentId) throws MentorMeException {
    List<Document> docs;
    if (EntityTypes.MENTEE_MENTOR_PROGRAM.equalsIgnoreCase(entityType)) {
        docs = menteeMentorProgramService.get(entityId).getDocuments();
    } else if (EntityTypes.MENTEE_MENTOR_GOAL.equalsIgnoreCase(entityType)) {
        docs = menteeMentorGoalService.get(entityId).getDocuments();
    } else {
        throw new MentorMeException("The provided entityType is unknown.");
    }
    boolean removed = false;
    Iterator<Document> it = docs.iterator();
    while (it.hasNext()) {
        Document doc = it.next();
        if (doc.getId() == documentId) {
            it.remove();
            removed = true;
            break;
        }
    }
    if (!removed) {
        throw new EntityNotFoundException("The document is not in the entity");
    }
}

[Buggy Hunk]
docs = menteeMentorGoalService.get(entityId).getDocuments();

[Patch]
docs = menteeMentorGoalService.get(entityId).getGoal().getDocuments();