[Demonstration 1]

[Buggy Method]
public void unpackZip(final File dir, final String zipname) {
    //create a folder for extracted files
    final File path = new File(dir.getAbsolutePath() + "/Frames");
    if (!path.exists()) {
        path.mkdirs();
    }
    new AsyncTask<String, Integer, File>() {

        private Exception m_error = null;

        @Override
        protected File doInBackground(String... params) {
            try {
                InputStream is;
                ZipInputStream zis;
                is = new FileInputStream(dir + "/" + zipname);
                zis = new ZipInputStream(new BufferedInputStream(is));
                ZipEntry ze;
                while ((ze = zis.getNextEntry()) != null) {
                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    byte[] buffer = new byte[1024];
                    int count;
                    String filename = ze.getName();
                    FileOutputStream fout = new FileOutputStream(path + "/" + filename);
                    // reading and writing
                    while ((count = zis.read(buffer)) != -1) {
                        baos.write(buffer, 0, count);
                        byte[] bytes = baos.toByteArray();
                        fout.write(bytes);
                        baos.reset();
                    }
                    fout.close();
                    zis.closeEntry();
                }
                zis.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return null;
        }

        @Override
        protected void onPostExecute(File file) {
            // show message in case of error
            if (m_error != null) {
                m_error.printStackTrace();
                return;
            }
            //go to Main Menu
            Intent intent = new Intent(splashScreen.this, MainMenu.class);
            startActivity(intent);
            //to disable return to splash screen
            finish();
        }
    }.execute(path.getAbsolutePath());
}

[Buggy Hunk]
Intent intent = new Intent(splashScreen.this, MainMenu.class);

[Patch]
Intent intent = new Intent(SplashScreen.this, MainMenu.class);

[Demonstration 2]

[Buggy Method]
@Override
public boolean nextKeyValue() throws IOException, InterruptedException {
    String currentLine;
    if (startedReading == true && (currentLine = br.readLine()) != null) {
        // Reading already opened file
        currentValue.set(currentLine);
        return true;
    } else {
        // Open a new file
        if (startedReading) {
            zip.closeEntry();
        }
        ZipEntry entry = null;
        try {
            entry = zip.getNextEntry();
        } catch (ZipException e) {
            if (ZipFileInputFormat.getLenient() == false)
                throw e;
        }
        // Sanity check
        if (entry == null) {
            isFinished = true;
            return false;
        }
        // Filename
        currentKey.set(entry.getName());
        InputStreamReader isr = new InputStreamReader(zip);
        br = new BufferedReader(isr);
        currentLine = br.readLine();
        currentValue.set(currentLine);
        startedReading = true;
        return true;
    }
}

[Buggy Hunk]
entry = zip.getNextEntry();

[Patch]
while ((entry = zip.getNextEntry()) != null && entry.isDirectory());

[Demonstration 3]

[Buggy Method]
private void runWithLQNS() {
    try {
        String solverProgram = "lqns";
        String command = solverProgram + " " + filePath + /*" -f"+*/
        " -z iteration-limit=1000";
        // String command = solverProgram+" "+filePath; //without using the
        // fast option
        ProcessBuilder pb = new ProcessBuilder(splitToCommandArray(command));
        Process proc = pb.start();
        readStream(proc.getInputStream(), false);
        readStream(proc.getErrorStream(), true);
        int exitVal = -1;
        try {
            exitVal = proc.waitFor();
        } catch (InterruptedException e) {
            logger.debug("Evaluation of model: " + filePath + " was interrupted");
        }
        proc.destroy();
        if (exitVal == LQNS_RETURN_SUCCESS) {
            instance.setEvaluated(true);
        } else if (exitVal == LQNS_RETURN_MODEL_FAILED_TO_CONVERGE) {
            logger.error(MessageStrings.LQNS_SOLVER + " exited with " + exitVal + ": The model failed to converge. Results are most likely inaccurate. ");
            logger.error("Analysis Result has been written to: " + resultfilePath);
            instance.setEvaluated(false);
        } else {
            String message = "";
            if (exitVal == LQNS_RETURN_INVALID_INPUT) {
                message = solverProgram + " exited with " + exitVal + ": Invalid Input.";
            } else if (exitVal == LQNS_RETURN_FATAL_ERROR) {
                message = solverProgram + " exited with " + exitVal + ": Fatal error";
            } else {
                message = solverProgram + " returned an unrecognised exit value " + exitVal + ". Key: 0 on success, 1 if the model failed to meet the convergence criteria, 2 if the input was invalid, 4 if a command line argument was incorrect, 8 for file read/write problems and -1 for fatal errors. If multiple input files are being processed, the exit code is the bit-wise OR of the above conditions.";
            }
            logger.error(message);
            instance.setEvaluated(false);
        }
    } catch (IOException e) {
        logger.error("Error in evaluting the  solution ", e);
    }
}

[Buggy Hunk]
readStream(proc.getInputStream(), false);

[Patch]
readStream(proc.getInputStream(), true);