[Demonstration 1]

[Buggy Method]
public List<String> getDataLocationPreferace(Connection connection, Long uid) throws SQLException {
    LogicalData lData = getFromLDataCache(uid, null);
    List<String> dataPref = null;
    if (lData != null) {
        dataPref = lData.getDataLocationPreferences();
        if (dataPref != null) {
            return dataPref;
        }
    }
    dataPref = new ArrayList<>();
    try (PreparedStatement ps = connection.prepareStatement("SELECT resourceUri " + "FROM ldata_table " + "JOIN pref_table ON ld_uid = uid " + "JOIN storage_site_table ON storageSiteId = storageSiteRef " + "WHERE ldata_table.uid = ?", ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE)) {
        ps.setLong(1, uid);
        //            ps.setBoolean(2, includePrivate);
        ResultSet rs = ps.executeQuery();
        while (rs.next()) {
            dataPref.add(rs.getString(1));
        }
    }
    if (lData != null) {
        lData.setDataLocationPreferences(dataPref);
        putToLDataCache(lData, null);
    }
    return dataPref;
}

[Buggy Hunk]
if (dataPref != null) {

[Patch]
if (dataPref != null && !dataPref.isEmpty()) {

[Demonstration 2]

[Buggy Method]
public static void read(Counter black, Counter white) {
    for (String line : weights.split("")) {
        String[] parts = line.split(":");
        if (parts.length == 3)
            if (parts[0].trim().equals("black"))
                black.put(parts[1].trim(), Double.parseDouble(parts[2].trim()));
            else
                white.put(parts[1].trim(), Double.parseDouble(parts[2].trim()));
    }
}

[Buggy Hunk]
for (String line : weights.split("")) {

[Patch]
for (String line : score.split("\n")) {

[Demonstration 3]

[Buggy Method]
private LatLng addLocation(Coordinate location) {
    LatLng location1 = new LatLng(location.getLatitude(), location.getLongitude());
    Date date = new Date(location.getTimeStamp());
    SimpleDateFormat dateFormat = new SimpleDateFormat("MMMM d yyyy h:mm:ss a", Locale.US);
    String dateStamp = dateFormat.format(date);
    Log.d("Timestamp in maps", dateStamp);
    mMap.addMarker(new MarkerOptions().position(location1).title(dateStamp));
    return location1;
}

[Buggy Hunk]
Date date = new Date(location.getTimeStamp());

[Patch]
Date date = new Date(location.getTimeStamp() * 1000);