[Demonstration 1]

[Buggy Method]
public static OMElement getResourceDocumentElement(File resourceFile) throws XMLStreamException, IOException {
    OMElement resourceElement;
    FileInputStream fis = null;
    XMLStreamReader reader = null;
    try {
        fis = FileUtils.openInputStream(resourceFile);
        reader = xif.createXMLStreamReader(fis);
        StAXOMBuilder builder = new StAXOMBuilder(reader);
        resourceElement = builder.getDocumentElement();
        resourceElement.detach();
    } catch (XMLStreamException e) {
        throw new XMLStreamException(e.getMessage(), e);
    } catch (IOException e) {
        throw new IOException(e.getMessage(), e);
    } finally {
        try {
            if (fis != null) {
                fis.close();
            }
        } catch (IOException e) {
            log.error(e.getMessage(), e);
        }
        try {
            if (reader != null) {
                reader.close();
            }
        } catch (XMLStreamException e) {
            log.error(e.getMessage(), e);
        }
    }
    return resourceElement;
}

[Buggy Hunk]
reader = xif.createXMLStreamReader(fis);

[Patch]
reader = xmlInputFactory.createXMLStreamReader(fis);

[Demonstration 2]

[Buggy Method]
private void updateDatabase(String uname, String pass) {
    try {
        FileWriter writer = new FileWriter(loginData);
        writer.append(uname + " " + pass + "\n");
        writer.close();
    } catch (IOException ex) {
        Logger.getLogger(GomokuServerModel.class.getName()).log(Level.SEVERE, null, ex);
    }
}

[Buggy Hunk]
FileWriter writer = new FileWriter(loginData);

[Patch]
FileWriter writer = new FileWriter(loginDatabase);

[Demonstration 3]

[Buggy Method]
@Nullable
public String getLastAndroidId() {
    return preferences.getString(KEY_LAST_ANDROID_ID);
}

[Buggy Hunk]
public String getLastAndroidId() {

[Patch]
public synchronized String getLastAndroidId() {