[Demonstration 1]

[Buggy Method]
private void onComputeGraph(Object entity, EntitySaveGraph objectGraph, Client client, String rowId, Class<?> entityClass) {
    IndexManager mgr = null;
    Set<?> chids = new HashSet();
    EntityMetadata childMetadata = null;
    Client childClient = null;
    Class<?> childClazz = null;
    try {
        if (entity.getClass().equals(objectGraph.getChildClass())) {
            String query = AssociationBuilder.getQuery(DocumentIndexer.PARENT_ID_CLASS, objectGraph.getParentClass().getCanonicalName().toLowerCase(), DocumentIndexer.ENTITY_ID_FIELD, rowId);
            childClazz = objectGraph.getParentClass();
            childMetadata = getMetadata(childClazz);
            childClient = getClient(childMetadata);
            chids = populateAssociation(entity, objectGraph.getProperty(), childClient, query, objectGraph.getParentClass());
        } else {
            childClazz = objectGraph.getChildClass();
            childMetadata = getMetadata(childClazz);
            childClient = getClient(childMetadata);
            String query = AssociationBuilder.getQuery(DocumentIndexer.PARENT_ID_CLASS, entity.getClass().getCanonicalName().toLowerCase(), DocumentIndexer.PARENT_ID_FIELD, rowId);
            //if it is a case of shared primary key then it will share same primary key!
            if (objectGraph.isSharedPrimaryKey()) {
                List c = new ArrayList();
                c.add(childClient.find(childClazz, rowId));
                chids = onReflect(entityClass, objectGraph.getProperty(), c);
            } else {
                chids = populateAssociation(entity, objectGraph.getProperty(), childClient, query, childClazz);
            }
        }
        onBiDirection(entity, objectGraph, client, rowId, entityClass, chids, childMetadata, childClient);
    } catch (Exception e) {
        // TODO Proper handling is must.
        e.printStackTrace();
    }
}

[Buggy Hunk]
chids =  onReflect(entityClass, objectGraph.getProperty(), c);

[Patch]
chids =  onReflect(entity, objectGraph.getProperty(), c);

[Demonstration 2]

[Buggy Method]
@Override
protected List<TableFieldSchema> createTableFields() {
    List<TableFieldSchema> fields = new ArrayList<>();
    // use reflection to build fields
    PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(targetClass);
    for (PropertyDescriptor descriptor : propertyDescriptors) {
        propertyDescriptorMap.put(descriptor.getName(), descriptor);
        if (!excludedProperties.contains(descriptor.getName())) {
            TableFieldSchema field = fieldFromPropertyDescriptor(descriptor);
            if (field != null) {
                fields.add(field);
            }
        }
    }
    // now add in the pre-defined fields
    fields.addAll(definedFields.values());
    return fields;
}

[Buggy Hunk]
PropertyDescriptor[] propertyDescriptors = BeanUtils.getPropertyDescriptors(targetClass);

[Patch]
List<PropertyDescriptor> propertyDescriptors = propertyDescriptors(targetClass);

[Demonstration 3]

[Buggy Method]
public Connection createConnection() throws JMSException {
    return createConnection(properties.getUser(), properties.getPassword());
}

[Buggy Hunk]
return createConnection(properties.getUser(), properties.getPassword());

[Patch]
return createConnection(this.properties.getUser(), this.properties.getPassword());