[Demonstration 1]

[Buggy Method]
public static Date asDate(Object value) {
    if (value instanceof Date) {
        return (Date) value;
    } else if (value instanceof CharSequence) {
        String date = value.toString().trim();
        try {
            LocalDateTime time;
            if (date.endsWith("Z")) {
                time = LocalDateTime.parse((CharSequence) value, DateTimeFormatter.ISO_INSTANT.withZone(Clock.systemUTC().getZone()));
            } else {
                time = LocalDateTime.parse((CharSequence) value, DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(Clock.systemUTC().getZone()));
            }
            return new Date(time.atZone(Clock.systemUTC().getZone()).toInstant().toEpochMilli());
        } catch (RuntimeException e) {
            throw new ConfigException(e, "Unable to parse date: \"" + date + "\": " + e.getMessage());
        }
    } else if (value instanceof Long) {
        // Longs are assumed to be java time (millis since epoch).
        return new Date((Long) value);
    } else if (value instanceof Integer) {
        // Integers are assumed to be unix time (seconds since epoch).
        return new Date(((Integer) value).longValue() * 1000L);
    } else {
        throw new IncompatibleValueException("Unable to convert " + value.getClass().getSimpleName() + " to a date");
    }
}

[Buggy Hunk]
throw new ConfigException(e, "Unable to parse date: \"" + date + "\": " + e.getMessage());

[Patch]
throw new ConfigException(e, "Unable to parse date: " + e.getMessage());

[Demonstration 2]

[Buggy Method]
@RequestMapping(value = "/parse", method = RequestMethod.POST)
public ResponseEntity parse(@RequestBody String text) {
    //String orginText = "明天上午9点到11点把微信小程序的技术学一下";
    URL url = getClass().getResource("/TimeExp.m");
    TimeNormalizer timeNormalizer = new TimeNormalizer(url.toString(), true);
    timeNormalizer.parse(text);
    TimeUnit[] units = timeNormalizer.getTimeUnit();
    ArrayList<TimeAppoint> result = new ArrayList<>();
    for (TimeUnit unit : units) {
        TimeAppoint one = new TimeAppoint();
        one.setAllDay(unit.getIsAllDayTime());
        one.setTimeExpression(unit.Time_Expression);
        // fix now bug
        if (unit.getTime() != null && unit.getTime().getTime() > 0) {
            one.setTime(unit.getTime());
            one.setTimeNorm(unit.Time_Norm);
        } else {
            one.setTime(new Date(System.currentTimeMillis()));
            //TODO current time string
            one.setTimeNorm("");
        }
        result.add(one);
    }
    return ResponseEntity.ok(result);
}

[Buggy Hunk]
one.setTime(unit.getTime());

[Patch]
one.setTime(new Date(unit.getTime().getTime() - 8*3600*1000L));

[Demonstration 3]

[Buggy Method]
private Object readSum() {
    globbleSpace();
    Object result = readTerm();
    while (true) {
        globbleSpace();
        if (accept(TYPE.OP_PLUS)) {
            Object term = readTerm();
            if ((term instanceof String) || (result instanceof String))
                result = String.valueOf(result) + String.valueOf(term);
            else
                result = asInt(result) + asInt(term);
        } else if (accept(TYPE.OP_MINUS)) {
            result = asInt(result) - asInt(readTerm());
        } else {
            return result;
        }
    }
}

[Buggy Hunk]
private Object readSum() {

[Patch]
private Object readSum() throws ParsingException {