[Demonstration 1]

[Buggy Method]
@Override
public void sendAsync(RowMap r, AbstractAsyncProducer.CallbackCompleter cc) throws Exception {
    String key = r.pkToJson(keyFormat);
    String value = r.toJSON(outputConfig);
    Message message;
    // use database name and table name as message tag, ex: db_test.table_test
    StringBuilder messageTag = new StringBuilder(r.getDatabase());
    messageTag.append(".").append(r.getTable());
    // using table name as tag
    if (r instanceof DDLMap) {
        message = new Message(ddlTopic, messageTag.toString(), key, value.getBytes());
    } else {
        message = new Message(topic, messageTag.toString(), key, value.getBytes());
    }
    RocketMQCallback callback = new RocketMQCallback(cc, r.getPosition(), key, value, this.metricsTimer, this.succeededMessageCount, this.failedMessageCount, this.succeededMessageMeter, this.failedMessageMeter, this.context);
    try {
        rocketmq.send(message, queueSelector, messageTag, callback);
    } catch (Exception e) {
        LOGGER.error("send message error", e.getMessage());
    }
}

[Buggy Hunk]
rocketmq.send(message, queueSelector, messageTag, callback);

[Patch]
rocketmq.send(message, queueSelector, messageTag.toString(), callback);

[Demonstration 2]

[Buggy Method]
private static Object execute(String sql, boolean isUpdate) throws SQLException {
    try {
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection(MYSQL_DATABASE_SERVER, MYSQL_USERNAME, MYSQL_PASSWORD);
        Statement statement = connection.createStatement();
        statement.executeQuery("USE " + MYSQL_DATABASE_NAME + ";");
        if (isUpdate)
            return statement.executeUpdate(sql);
        else
            return statement.executeQuery(sql);
    } catch (ClassNotFoundException e) {
        e.printStackTrace();
        return null;
    }
}

[Buggy Hunk]
Statement statement = connection.createStatement();

[Patch]
PreparedStatement statement = connection.prepareStatement(sql);

[Demonstration 3]

[Buggy Method]
@Override
protected boolean isInputFileCorrect() {
    Pattern pt = Pattern.compile("^(Технополис|Видеолукс|WEB|GSM)");
    for (int row = TechnopolisConstants.FIRST_ROW; row <= inputDataSheet.getLastRowNum(); row++) {
        CellReference shopCellRef = new CellReference("C" + (row + 1));
        Cell shopCell = inputDataSheet.getRow(shopCellRef.getRow()).getCell(shopCellRef.getCol());
        Matcher m = pt.matcher(shopCell.getStringCellValue());
        if (m.find()) {
            return true;
        }
    }
    return false;
}

[Buggy Hunk]
Cell shopCell = inputDataSheet.getRow(shopCellRef.getRow()).getCell(shopCellRef.getCol());

[Patch]
Cell shopCell = CellUtil.getRow(shopCellRef.getRow(), inputDataSheet).getCell(shopCellRef.getCol(), Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);