[Demonstration 1]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));

[Demonstration 2]

[Buggy Method]
@Override
public void play(Utente ut, Gioco g) throws SQLException {
    Connection connection = DB.openConnection();
    PreparedStatement ps = connection.prepareStatement(PLAY);
    ps.setInt(1, ut.getPuntiExp());
    ps.setInt(2, g.getExp());
    ps.setString(3, ut.getUsername());
    ps.executeUpdate();
    ps.close();
    PreparedStatement ps2 = connection.prepareStatement(UPDATELEVEL);
    if (ut.getPuntiExp() >= 500)
        ps2.setInt(1, 5);
    else
        ps2.setInt(1, ut.getPuntiExp());
    ps2.setString(2, ut.getUsername());
    ps2.executeUpdate();
    ps2.close();
    connection.close();
    ut.setPuntiExp(ut.getPuntiExp() + g.getExp());
    if (ut.getPuntiExp() >= 500) {
        ut.setLivello(5);
    } else
        ut.setLivello(ut.getPuntiExp() / 100);
}

[Buggy Hunk]
ps2.setInt(1, ut.getPuntiExp());

[Patch]
ps2.setInt(1, ut.getPuntiExp()/100);

[Demonstration 3]

[Buggy Method]
public static String testConfig(DestinationConfig destinationConfig) throws SQLException {
    Connection conn = null;
    try {
        StringBuilder sb = new StringBuilder();
        conn = DriverManager.getConnection(String.format("jdbc:mysql://%s?connectTimeout=4000", destinationConfig.getDbAddress()), destinationConfig.getDbUser(), destinationConfig.getDbPassword());
        for (DestinationConfig.TableConfig tableConfig : destinationConfig.getTableConfigs()) {
            PreparedStatement statement = conn.prepareStatement("select * from  " + tableConfig.getTableName() + "  limit 1 ");
            ResultSet resultSet = statement.executeQuery();
            if (resultSet.next()) {
                Map<String, String> row = Maps.newHashMap();
                int columnCount = resultSet.getMetaData().getColumnCount();
                for (int i = 1; i <= columnCount; i++) {
                    String columnName = resultSet.getMetaData().getColumnName(i);
                    row.put(columnName, resultSet.getString(columnName));
                }
                JSONObject jsonObject = new JSONObject();
                jsonObject.put("event", "insert");
                jsonObject.put("rowList", Arrays.asList(row));
                byte[] bytes = jsonObject.toJSONString().getBytes(Charsets.UTF_8);
                RedisMessageQueue redisMessageQueue = RedisUtils.createRedisMessageQueue(tableConfig.getRedisHost(), tableConfig.getRedisPort(), tableConfig.getRedisPassword());
                redisMessageQueue.publish(tableConfig.getTopic(), bytes);
                redisMessageQueue.close();
                sb.append(tableConfig.getTableName() + " is  ok\r\n");
            }
            resultSet.close();
            statement.close();
        }
        return sb.toString();
    } catch (Exception e) {
        return e.getMessage();
    } finally {
        if (conn != null) {
            conn.close();
        }
    }
}

[Buggy Hunk]
redisMessageQueue.publish(tableConfig.getTopic() ,bytes );

[Patch]
redisMessageQueue.publish( "test_"+tableConfig.getTopic() ,bytes );