[Demonstration 1]

[Buggy Method]
@RequestMapping(method = RequestMethod.GET, value = "/api/missions")
public ResponseEntity<?> getMissions(@RequestParam("operatorToken") String operatorToken) {
    if (operatorService.tokenExists(operatorToken) && !missionService.isAnyMissionDone(securityHolder.getUserPrincipal().getUsername())) {
        return ResponseEntity.ok(missionService.getDefaultMission());
    } else {
        return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
    }
}

[Buggy Hunk]
if(operatorService.tokenExists(operatorToken) && !missionService.isAnyMissionDone(securityHolder.getUserPrincipal().getUsername())) {

[Patch]
if(operatorService.tokenExists(operatorToken) && !operatorService.isVerified(operatorToken)) {

[Demonstration 2]

[Buggy Method]
private Variable getVariableFromExpression(Expression e) {
    String clazz = getClassName(e);
    if (e instanceof NameExpr) {
        NameExpr ne = (NameExpr) e;
        String name = ne.getName().toString();
        Declaration d = JavaParserFacade.get(combinedTypeSolver).solve(ne).getCorrespondingDeclaration();
        if (d instanceof JavaParserFieldDeclaration) {
            JavaParserFieldDeclaration jpfd = (JavaParserFieldDeclaration) d;
            if (jpfd.getWrappedNode().getModifiers().contains(Modifier.STATIC)) {
                return new Variable(Variable.Scope.staticfield, name, clazz);
            } else {
                return new Variable(Variable.Scope.field, name, clazz);
            }
        } else if (d instanceof JavaParserSymbolDeclaration || d instanceof JavaParserParameterDeclaration) {
            return new Variable(Variable.Scope.local, name, clazz);
        }
    } else if (e instanceof FieldAccessExpr) {
        FieldAccessExpr fae = (FieldAccessExpr) e;
        String name = fae.getName().toString();
        Expression scope = getFirstScope(fae);
        try {
            Declaration d = JavaParserFacade.get(combinedTypeSolver).solve(fae.getScope().get()).getCorrespondingDeclaration();
            if (d instanceof JavaParserFieldDeclaration) {
                JavaParserFieldDeclaration jpfd = (JavaParserFieldDeclaration) d;
                if (jpfd.getWrappedNode().getModifiers().contains(Modifier.STATIC)) {
                    return new Variable(Variable.Scope.staticfield, name, clazz);
                } else {
                    return new Variable(Variable.Scope.field, name, clazz);
                }
            } else if (d instanceof JavaParserSymbolDeclaration) {
                return new Variable(Variable.Scope.local, name, clazz);
            }
        } catch (UnsupportedOperationException uoe) {
            return new Variable(Variable.Scope.staticfield, name, clazz);
        }
    }
    throw new IllegalArgumentException();
}

[Buggy Hunk]
return new Variable(Variable.Scope.field, name, clazz);

[Patch]
return new Variable(Variable.Scope.field, scope.toString() + "." + name, clazz);

[Demonstration 3]

[Buggy Method]
private Entity checkFloorPanel() {
    Entity floorPanel = null;
    Entity finalFloor = null;
    boolean leftPanel = false;
    boolean rightPanel = false;
    boolean leftCorner = false;
    boolean rightCorner = false;
    boolean leftFall = false;
    boolean rightFall = false;
    int securityGap = 10;
    /* Obtains the square where the center point of the player is placed */
    int playerHeight2 = player.getCurrentAnimation().getImage().getHeight() / 2;
    int[] playerCenter = player.getCenter();
    int[] playerSquare = player.getSquare(playerCenter[0], playerCenter[1]);
    // Checks that the square is within the room
    if (playerSquare[0] >= 0 && playerSquare[1] >= 0 && playerSquare[0] <= 3 && playerSquare[1] <= 9) {
        /* Checks if there is a panel floor type object in current square */
        List<Entity> bEntities = currentRoom.getSquare(playerSquare[0], playerSquare[1]).getBackground();
        List<Entity> fEntities = currentRoom.getSquare(playerSquare[0], playerSquare[1]).getForeground();
        List<Entity> bgEntities = new LinkedList<Entity>();
        bgEntities.addAll(bEntities);
        bgEntities.addAll(fEntities);
        for (Entity bgE : bgEntities) {
            String name = bgE.getTypeOfEntity();
            if ((name.startsWith("FloorPanel_") && name.startsWith("skeleton")) || (name.startsWith("Pillar_") && !name.contains("shadow") && !name.contains("top")) || name.startsWith("Opener") || name.startsWith("Closer") || name.startsWith("SpikeFloor")) {
                int bgLeft = (int) bgE.getBoundingBox().getMinX();
                int bgRight = (int) bgE.getBoundingBox().getMaxX();
                int bgTop = (int) bgE.getBoundingBox().getMinY();
                int[] ec = bgE.getCenter();
                if (name.contains("left") && ((ec[1] - playerCenter[1]) <= playerHeight2 + securityGap)) {
                    floorPanel = bgE;
                    // player lands on the floor (according to y axis)
                    if ((playerCenter[0] >= bgLeft) && (playerCenter[0] <= bgRight)) {
                        // player lands on the floor (according to x axis)
                        //							//System.out.println("LEFT LANDING");
                        leftPanel = true;
                    } else {
                        // player falls, there is no floor beneath him
                        leftFall = true;
                        //							newPlayerX = ec[0] - bgWidth / 4;
                    }
                } else if (name.contains("right") && ((ec[1] - playerCenter[1]) <= playerHeight2 + securityGap)) {
                    floorPanel = bgE;
                    if ((playerCenter[0] >= bgLeft) && (playerCenter[0] <= bgRight)) {
                        //							//System.out.println("RIGHT LANDING");
                        rightPanel = true;
                    } else {
                        rightFall = true;
                        //							newPlayerX = ec[0] + bgWidth;
                    }
                }
                if (name.startsWith("Opener")) {
                    finalFloor = bgE;
                    if (((Opener) bgE).getDoor() == null) {
                        for (Door d : doors) {
                            if (d.getId() == ((Opener) bgE).getId()) {
                                ((Opener) bgE).setDoor(d);
                            }
                        }
                    }
                    ((Opener) bgE).openDoor(player);
                } else if (name.startsWith("Closer")) {
                    finalFloor = bgE;
                    if (((Closer) bgE).getDoor() == null) {
                        for (Door d : doors) {
                            if (d.getId() == ((Closer) bgE).getId()) {
                                ((Closer) bgE).setDoor(d);
                            }
                        }
                    }
                    ((Closer) bgE).closeDoor(player);
                }
                if (name.startsWith("SpikeFloor")) {
                    finalFloor = bgE;
                    if (!((SpikeFloor) bgE).isActivated()) {
                        ((SpikeFloor) bgE).activate(player);
                        if (player.getCurrentAnimation().getId().startsWith("running") && !player.isJumping()) {
                            bgRight = (int) bgE.getBoundingBox().getMaxX();
                            bgTop = (int) bgE.getBoundingBox().getMaxY();
                            if (player.getCurrentAnimation().equals("right")) {
                                player.setX(bgRight - 16);
                            } else {
                                player.setX(bgRight - 32);
                            }
                            player.setY(bgTop - 16);
                            player.setSpiked();
                        }
                    }
                }
            } else if (name.startsWith("Corner_")) {
                if (name.contains("left")) {
                    leftCorner = true;
                } else if (name.contains("right")) {
                    rightCorner = true;
                }
            }
        }
        /* Player's behaviour */
        if (leftFall && !leftCorner)
            leftPanel = true;
        else if (leftFall && leftCorner) {
            leftPanel = false;
        }
        if (rightFall && !rightCorner)
            rightPanel = true;
        else if (rightFall && rightCorner) {
            rightPanel = false;
        }
    }
    if (leftPanel || rightPanel) {
        finalFloor = floorPanel;
    }
    return finalFloor;
}

[Buggy Hunk]
if ( (name.startsWith("FloorPanel_") && name.startsWith("skeleton")) ||

[Patch]
if ( (name.startsWith("FloorPanel_") && !name.contains("skeleton")) ||