[Demonstration 1]

[Buggy Method]
public void open() {
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection("jdbc:mysql://cslvm74.csc.calpoly.edu/cjacob07", "cjacob07", "Ma94ne07k");
}

[Buggy Hunk]
public void open() {

[Patch]
public void open() throws Exception {

[Demonstration 2]

[Buggy Method]
public void convert() {
    this.ts = scenario.getTransitSchedule();
    // Put all stops in the Schedule
    this.convertStops();
    int startDate = Integer.MAX_VALUE;
    for (Service service : this.feed.services.values()) {
        if (service.calendar != null && service.calendar.start_date < startDate) {
            startDate = service.calendar.start_date;
        }
        if (service.calendar_dates != null) {
            for (LocalDate localDate : service.calendar_dates.keySet()) {
                int exceptionDate = asGtfsDate(localDate);
                if (exceptionDate < startDate) {
                    startDate = exceptionDate;
                }
            }
        }
    }
    System.out.println("Earliest date mentioned in feed: " + startDate);
    int endDate = Integer.MIN_VALUE;
    for (Service service : this.feed.services.values()) {
        if (service.calendar != null && service.calendar.end_date > endDate) {
            endDate = service.calendar.end_date;
        }
        if (service.calendar_dates != null) {
            for (LocalDate localDate : service.calendar_dates.keySet()) {
                int exceptionDate = asGtfsDate(localDate);
                if (exceptionDate > endDate) {
                    endDate = exceptionDate;
                }
            }
        }
    }
    System.out.println("Latest date mentioned in feed: " + endDate);
    // Get the used service Id for the chosen weekday and date
    List<String> activeServiceIds = this.getActiveServiceIds(this.feed.services);
    System.out.printf("Active Services: %d %s\n", activeServiceIds.size(), activeServiceIds);
    // Get the Trips which are active today
    List<Trip> activeTrips = feed.trips.values().stream().filter(trip -> activeOn(trip.service)).collect(Collectors.toList());
    System.out.printf("Active Trips: %d %s\n", activeTrips.size(), activeTrips.stream().map(trip -> trip.trip_id).collect(Collectors.toList()));
    // Create one TransitLine for each GTFS-Route which has an active trip
    activeTrips.stream().map(trip -> trip.route).distinct().forEach(route -> {
        TransitLine tl = ts.getFactory().createTransitLine(Id.create(route.route_id, TransitLine.class));
        ts.addTransitLine(tl);
    });
    this.convertTrips(activeTrips);
    if (activeTrips.isEmpty()) {
        System.out.println("There are no converted trips. You might need to change the date for better results.");
    }
    System.out.println("Conversion successfull");
}

[Buggy Hunk]
List<Trip> activeTrips = feed.trips.values().stream().filter(trip -> activeOn(trip.service)/*trip.service.activeOn(this.date)*/ ).collect(Collectors.toList());

[Patch]
List<Trip> activeTrips = feed.trips.values().stream().filter(trip -> trip.service.activeOn(this.date)).collect(Collectors.toList());

[Demonstration 3]

[Buggy Method]
static Map<String, String> getIdColumns(Class<?> entityClass) {
    final Map<String, String> ret = new HashMap<String, String>();
    if (entityClass.getAnnotation(Entity.class) == null) {
        throw new IllegalArgumentException(entityClass.getName() + " does not have the Entity annotation");
    }
    // we need to walk up the inheritance chain
    while (entityClass != null) {
        for (Field field : entityClass.getDeclaredFields()) {
            final Column column = field.getAnnotation(Column.class);
            final Id id = field.getAnnotation(Id.class);
            // if we only want IDs, and this isn't an @Id, then skip
            if (column == null || id == null) {
                continue;
            }
            String columnName;
            // get the column name or field name
            if (column.name().isEmpty()) {
                columnName = field.getName();
            } else {
                columnName = column.name();
            }
            if (ret.put(columnName, field.getName()) != null) {
                throw new IllegalArgumentException("Entity contains two columns with the same name: " + columnName);
            }
        }
        // walk up the inheritance class
        entityClass = entityClass.getSuperclass();
    }
    if (ret.isEmpty()) {
        throw new IllegalArgumentException("Entity does not contain any columns");
    }
    return ret;
}

[Buggy Hunk]
static Map<String, String> getIdColumns(Class<?> entityClass) {

[Patch]
public static Map<String, String> getIdColumns(Class<?> entityClass) {