[Demonstration 1]

[Buggy Method]
@Override
public void run() {
    while (isRunning || !cars.isEmpty()) {
        try {
            Car car = cars.poll();
            if (car == null)
                continue;
            int fuelRequest = car.getFuel();
            log.info(logId + "requesting " + fuelRequest + " Liters from station");
            station.requestFuel(fuelRequest);
            car.addFuel(fuelRequest);
            sleep(SECONDS_PER_LITER * fuelRequest);
            double price = station.getFuelCost() * fuelRequest;
            station.payForFuel(price);
            log.info(logId + "got fuel for car " + car.getId() + ", now charging money");
            if (isRunning) {
                station.addCar(car);
            } else {
                car.leaveStation();
            }
            log.info(logId + "car " + car.getId() + "returned to station");
        } catch (Exception e) {
            log.severe(e.toString());
        }
    }
    log.info(logId + "is close.");
}

[Buggy Hunk]
log.severe(e.toString());

[Patch]
log.severe(logId + e.getStackTrace());

[Demonstration 2]

[Buggy Method]
public void logInfo(String message) {
    logInfo("INFO", message);
}

[Buggy Hunk]
logInfo("INFO", message);

[Patch]
logInfo("INFO", message, true, true);

[Demonstration 3]

[Buggy Method]
@SuppressWarnings("unchecked")
public static void searchForTarget(EntityCreature entity) {
    if (entity.targetTasks.taskEntries.size() >= 1 || (entity instanceof EntityEnderman) || (entity instanceof EntityTameable && ((EntityTameable) entity).isTamed())) {
        entity.getEntityData().setInteger("ESM_TARGET_COOLDOWN", 0);
        return;
    }
    int cooldown = entity.getEntityData().getInteger("ESM_TARGET_COOLDOWN");
    if (cooldown > 0) {
        entity.getEntityData().setInteger("ESM_TARGET_COOLDOWN", cooldown - 1);
        return;
    } else {
        entity.getEntityData().setInteger("ESM_TARGET_COOLDOWN", 60);
    }
    EntityLivingBase target = entity.getAITarget();
    target = target != null && target.isEntityAlive() ? target : entity.getAttackTarget();
    target = target != null && target.isEntityAlive() ? target : (entity.getEntityToAttack() instanceof EntityLivingBase ? (EntityLivingBase) entity.getEntityToAttack() : target);
    if (target != null && target.isEntityAlive()) {
        if (ESM_Settings.TargetCap >= 0 && ESM_PathCapHandler.attackMap.get(target) != null && ESM_PathCapHandler.attackMap.get(target).size() > ESM_Settings.TargetCap && !ESM_Utils.isCloserThanOtherAttackers(entity.worldObj, entity, target)) {
            entity.getNavigator().clearPathEntity();
            entity.setAttackTarget(null);
            entity.setTarget(null);
            entity.setRevengeTarget(null);
            return;
        }
        if (entity.getDistanceToEntity(target) > ESM_Settings.Awareness) {
            entity.getNavigator().clearPathEntity();
            entity.setAttackTarget(null);
            entity.setTarget(null);
            entity.setRevengeTarget(null);
            return;
        }
        if (!entity.hasPath() && ESM_Settings.forcePath) {
            // This entity may be auto-invalidating its current target/path
            entity.setPathToEntity(entity.worldObj.getPathEntityToEntity(entity, target, ESM_Settings.Awareness, true, false, false, true));
            entity.getEntityData().setInteger("ESM_TARGET_COOLDOWN", 10);
        }
        // In case the target hasn't been applied to both variables yet we just re-set both of them.
        entity.setTarget(target);
        entity.setAttackTarget(target);
        entity.setRevengeTarget(target);
        return;
    }
    EntityLivingBase closestTarget = null;
    ArrayList<EntityLiving> targets = new ArrayList<EntityLiving>();
    targets.addAll(entity.worldObj.selectEntitiesWithinAABB(EntityLivingBase.class, entity.boundingBox.expand(ESM_Settings.Awareness, ESM_Settings.Awareness, ESM_Settings.Awareness), new GenericEntitySelector(entity)));
    Collections.sort(targets, new EntityAINearestAttackableTarget.Sorter(entity));
    for (int i = 0; i < targets.size(); i++) {
        EntityLivingBase subject = targets.get(i);
        if (ESM_Settings.TargetCap < 0 || ESM_PathCapHandler.attackMap.get(subject) == null || ESM_PathCapHandler.attackMap.get(subject).size() < ESM_Settings.TargetCap || ESM_Utils.isCloserThanOtherAttackers(entity.worldObj, entity, subject)) {
            closestTarget = subject;
            // List is sorted, no need to continue looping through everything
            break;
        }
    }
    entity.setTarget(closestTarget);
    entity.setAttackTarget(closestTarget);
    entity.setRevengeTarget(closestTarget);
    if (closestTarget != null) {
        entity.setPathToEntity(entity.worldObj.getPathEntityToEntity(entity, closestTarget, ESM_Settings.Awareness, true, false, false, true));
        ESM_PathCapHandler.AddNewAttack(entity, closestTarget);
    }
}

[Buggy Hunk]
if(entity.targetTasks.taskEntries.size() >= 1 || (entity instanceof EntityEnderman) || (entity instanceof EntityTameable && ((EntityTameable)entity).isTamed()))

[Patch]
if(usesAI(entity) || (entity instanceof EntityEnderman) || (entity instanceof EntityTameable && ((EntityTameable)entity).isTamed()))