[Demonstration 1]

[Buggy Method]
public AppiumServiceBuilder appiumServerForAndroid(String deviceID, String methodName) throws Exception {
    System.out.println("**************************************************************************\n");
    System.out.println("Starting Appium Server to handle Android Device::" + deviceID + "\n");
    System.out.println("**************************************************************************\n");
    int port = ap.getPort();
    int chromePort = ap.getPort();
    int bootstrapPort = ap.getPort();
    int selendroidPort = ap.getPort();
    AppiumServiceBuilder builder = new AppiumServiceBuilder().withAppiumJS(new File(prop.getProperty("APPIUM_JS_PATH"))).withArgument(GeneralServerFlag.LOG_LEVEL, "info").withLogFile(new File(System.getProperty("user.dir") + "/target/appiumlogs/" + deviceID.replaceAll("\\W", "_") + "__" + methodName + ".txt")).withArgument(AndroidServerFlag.CHROME_DRIVER_PORT, Integer.toString(chromePort)).withArgument(AndroidServerFlag.BOOTSTRAP_PORT_NUMBER, Integer.toString(bootstrapPort)).withIPAddress("127.0.0.1").withArgument(GeneralServerFlag.SESSION_OVERRIDE).withArgument(AndroidServerFlag.SUPPRESS_ADB_KILL_SERVER).withArgument(AndroidServerFlag.SELENDROID_PORT, Integer.toString(selendroidPort)).usingPort(port);
    /* and so on */
    ;
    appiumDriverLocalService = builder.build();
    appiumDriverLocalService.start();
    return builder;
}

[Buggy Hunk]
new AppiumServiceBuilder().withAppiumJS(new File(prop.getProperty("APPIUM_JS_PATH")))

[Patch]
new AppiumServiceBuilder()/*.withAppiumJS(new File(prop.getProperty("APPIUM_JS_PATH")))*/

[Demonstration 2]

[Buggy Method]
public boolean remove(Object x) {
    if (x == null)
        return false;
    java.util.Iterator<AnyType> itr = iterator();
    while (itr.hasNext()) {
        if (x.equals(itr.next())) {
            itr.remove();
            return true;
        }
    }
    return false;
}

[Buggy Hunk]
java.util.Iterator<AnyType> itr = iterator();

[Patch]
Iterator<AnyType> itr = iterator();

[Demonstration 3]

[Buggy Method]
private void storeTagImage(TagItem tag, String imageURL) {
    if (imageURL.equals(""))
        return;
    URL u;
    InputStream input = null;
    ByteArrayOutputStream output = null;
    try {
        u = new URL(imageURL);
        String filename = u.getFile();
        String suffix = ".jpg";
        int lastDot = filename.lastIndexOf('.');
        if (lastDot != -1) {
            suffix = filename.substring(lastDot).toLowerCase();
        }
        String mimeType = utils.MimeType.getMimeTypeFromExt(suffix);
        if (!mimeType.startsWith("image")) {
            // dont't know what kind of image this is, just guess it's a jpg
            mimeType = utils.MimeType.getMimeTypeFromExt(".jpg");
        }
        input = new BufferedInputStream(u.openStream());
        output = new ByteArrayOutputStream();
        IOUtils.copy(input, output);
        TagImageItem tagImage = new TagImageItem();
        tagImage.setTag(tag.getName());
        tagImage.setMimeType(mimeType);
        tagImage.setSizeBytes(output.size());
        tagImage.setImageData(output.toByteArray());
        SqlSession session = MyBatis.getSession().openSession();
        session.insert("database.TagMapper.setTagImage", tagImage);
        session.close();
    } catch (MalformedURLException mue) {
        System.out.println(mue.getMessage());
    } catch (IOException ioe) {
        System.out.println(ioe.getMessage());
    } finally {
        try {
            if (input != null)
                input.close();
            if (output != null)
                output.close();
        } catch (IOException ioe) {
        }
    }
}

[Buggy Hunk]
if(imageURL.equals("")) return;

[Patch]
if(imageURL == null || imageURL.equals("")) return;