[Demonstration 1]

[Buggy Method]
@Override
public void executeVoidMethod(Object o, Method method) {
    Object[] paramValues = new Object[method.getParameterTypes().length];
    for (int i = 0; i < method.getTypeParameters().length; i++) {
        if (!isServiceAvailable(method.getParameterTypes()[i])) {
            throw new IllegalStateException("The service " + method.getParameterTypes()[i].getCanonicalName() + " requested in " + o.getClass().getCanonicalName() + " is not available.");
        }
        paramValues[i] = getService(method.getParameterTypes()[i]);
    }
    try {
        method.setAccessible(true);
        method.invoke(o, paramValues);
    } catch (Exception e) {
        throw new IllegalStateException("The method can't be executed.", e);
    }
}

[Buggy Hunk]
for (int i = 0; i < method.getTypeParameters().length; i++) {

[Patch]
for (int i = 0; i < method.getParameterTypes().length; i++) {

[Demonstration 2]

[Buggy Method]
@Override
public OClass call(final OrientBaseGraph g) {
    String indexType = OClass.INDEX_TYPE.NOTUNIQUE.name();
    OType keyType = OType.STRING;
    String className = null;
    final String ancestorClassName = getClassName(elementClass);
    // READ PARAMETERS
    for (Parameter<?, ?> p : indexParameters) {
        if (p.getKey().equals("type"))
            indexType = p.getValue().toString().toUpperCase();
        else if (p.getKey().equals("keytype"))
            keyType = OType.valueOf(p.getValue().toString().toUpperCase());
        else if (p.getKey().equals("class"))
            className = p.getValue().toString();
    }
    if (className == null)
        className = ancestorClassName;
    final ODatabaseDocumentTx db = getRawGraph();
    final OSchema schema = db.getMetadata().getSchema();
    final OClass cls = schema.getOrCreateClass(className, schema.getClass(ancestorClassName));
    final OProperty property = cls.getProperty(key);
    if (property != null)
        keyType = property.getType();
    db.getMetadata().getIndexManager().createIndex(className + "." + key, indexType, new OPropertyIndexDefinition(className, key, keyType), cls.getPolymorphicClusterIds(), null);
    return null;
}

[Buggy Hunk]
cls.getPolymorphicClusterIds(), null);

[Patch]
cls.getPolymorphicClusterIds(), null, null);

[Demonstration 3]

[Buggy Method]
public Result register() {
    Form<SignUp> signUpForm = form(SignUp.class).bindFromRequest();
    if (signUpForm.hasErrors()) {
        return badRequest(signup.render(signUpForm));
    } else {
        User newUser = new User();
        newUser.create(signUpForm.get().username, signUpForm.get().fullname, signUpForm.get().email, signUpForm.get().password);
        newUser.insert();
        userObject = User.findByEmail(signUpForm.get().email);
        session().clear();
        session("username", signUpForm.get().username);
        currentUser = signUpForm.get().username;
        return redirect(routes.Application.ballot());
    }
}

[Buggy Hunk]
userObject = User.findByEmail(signUpForm.get().email);

[Patch]
userObject = User.findByUsername(signUpForm.get().username);