[Demonstration 1]

[Buggy Method]
@Override
public SaaSUser findByUserName(String username) {
    SaaSUser saaSUser = null;
    String saaSUserQuery = "FROM SaaSUser s WHERE s.username = :user";
    Query query = masterSessionFactory.getCurrentSession().createQuery(saaSUserQuery);
    query.setParameter("user", username);
    try {
        saaSUser = (SaaSUser) query.getSingleResult();
    } catch (NoResultException ex) {
    }
    return saaSUser;
}

[Buggy Hunk]
Query query = masterSessionFactory.getCurrentSession().createQuery(saaSUserQuery);

[Patch]
Query query = sessionFactory.getCurrentSession().createQuery(saaSUserQuery);

[Demonstration 2]

[Buggy Method]
private static Response sendRedirect(String redirectUri) {
    Response response = new Response();
    // Redirect with a 302 (Found) status code
    response.setStatus(HttpServletResponse.SC_FOUND);
    // Web container was rebasing location header against server URL
    // Not useful if relayState is already (and always) an absolute URL
    response.getHeaders().putSingle(LocationHeader.NAME, redirectUri);
    return response;
}

[Buggy Hunk]
response.setStatus(HttpServletResponse.SC_FOUND);

[Patch]
response.setStatus(Status.FOUND);

[Demonstration 3]

[Buggy Method]
public static void spawn(SewerLevel level) {
    if (!spawned && Dungeon.depth > 1 && Random.Int(5 - Dungeon.depth) == 0) {
        Ghost ghost = new Ghost();
        do {
            ghost.setPos(level.randomRespawnCell());
        } while (ghost.getPos() == -1);
        level.mobs.add(ghost);
        Actor.occupyCell(ghost);
        spawned = true;
        alternative = Random.Int(2) == 0;
        if (!alternative) {
            left2kill = 8;
        }
        given = false;
        processed = false;
        depth = Dungeon.depth;
        do {
            weapon = (Weapon) Generator.random(Generator.Category.WEAPON);
        } while (weapon instanceof MissileWeapon);
        if (Dungeon.isChallenged(Challenges.NO_ARMOR)) {
            armor = (Armor) new ClothArmor().degrade();
        } else {
            armor = (Armor) Generator.random(Generator.Category.ARMOR);
        }
        for (int i = 0; i < 3; i++) {
            Item another;
            do {
                another = Generator.random(Generator.Category.WEAPON);
            } while (another instanceof MissileWeapon);
            if (another.level() > weapon.level()) {
                weapon = (Weapon) another;
            }
            another = Generator.random(Generator.Category.ARMOR);
            if (another.level() > armor.level()) {
                armor = (Armor) another;
            }
        }
        weapon.identify();
        armor.identify();
    }
}

[Buggy Hunk]
if (!spawned && Dungeon.depth > 1 && Random.Int( 5 - Dungeon.depth ) == 0) {

[Patch]
if (!spawned && Dungeon.depth == 3) {