[Demonstration 1]

[Buggy Method]
public List<GeomPoint> getPointsOfWay(long way) {
    List<GeomPoint> points = new LinkedList<GeomPoint>();
    Connection conn = null;
    PreparedStatement statement = null;
    ResultSet rs = null;
    try {
        conn = cpds.getConnection();
        statement = conn.prepareStatement("select id as nd_ref, ST_AsGeoJson(wgs84long_lat) as point_json from node right join (select nd_ref from way_nd where way_ref=?) as way_nodes " + "on " + "node.id=way_nodes.nd_ref ");
        statement.setLong(1, way);
        rs = statement.executeQuery();
        while (rs.next()) {
            String pointInJson = rs.getString("point_json");
            ObjectMapper mapper = new ObjectMapper();
            PostgisGeom parsedPoint = mapper.readValue(pointInJson, PostgisGeom.class);
            GeomPoint newPoint = new GeomPoint();
            newPoint.nodeId = rs.getLong("nd_ref");
            newPoint.longitude = parsedPoint.coordinates[0];
            newPoint.latitude = parsedPoint.coordinates[1];
            points.add(newPoint);
        }
        statement.close();
        conn.close();
    } catch (SQLException e) {
        e.printStackTrace();
        try {
            statement.close();
            conn.close();
        } catch (SQLException e1) {
            e1.printStackTrace();
        }
    } catch (JsonParseException e) {
        e.printStackTrace();
    } catch (JsonMappingException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return points;
}

[Buggy Hunk]
statement = conn.prepareStatement("select id as nd_ref, ST_AsGeoJson(wgs84long_lat) as point_json from node right join (select nd_ref from way_nd where way_ref=?) as way_nodes " +

[Patch]
statement = conn.prepareStatement("select id as nd_ref, ST_AsGeoJson(wgs84long_lat) as point_json from node right join (select nd_ref from way_nd where way_ref=? order by \"order\") as way_nodes " +

[Demonstration 2]

[Buggy Method]
public boolean isConnected(City city) {
    return connections.contains(city);
}

[Buggy Hunk]
return connections.contains(city);

[Patch]
return connections.contains(new CityConnection(city, 0));

[Demonstration 3]

[Buggy Method]
public void updateJobOutput(String jobId, ExecutableState newStatus, Map<String, String> info, String output) {
    try {
        final JobOutputPO jobOutput = jobDao.getJobOutput(jobId);
        ExecutableState oldStatus = ExecutableState.valueOf(jobOutput.getStatus());
        if (newStatus != null && oldStatus == newStatus) {
            if (!ExecutableState.isValidStateTransfer(oldStatus, newStatus)) {
                throw new IllegalStateTranferException("there is no valid state transfer from:" + oldStatus + " to:" + newStatus);
            }
            jobOutput.setStatus(newStatus.toString());
        }
        if (info != null) {
            jobOutput.setInfo(info);
        }
        if (output != null) {
            jobOutput.setContent(output);
        }
        jobDao.updateJobOutput(jobOutput);
        logger.info("job id:" + jobId + " from " + oldStatus + " to " + newStatus);
    } catch (PersistentException e) {
        logger.error("error change job:" + jobId + " to " + newStatus.toString());
        throw new RuntimeException(e);
    }
}

[Buggy Hunk]
if (newStatus != null && oldStatus == newStatus) {

[Patch]
if (newStatus != null && oldStatus != newStatus) {