[Demonstration 1]

[Buggy Method]
@Override
public void run() {
    QueueingConsumer consumer;
    QueueingConsumer.Delivery delivery;
    ConnectionFactory factory = new ConnectionFactory();
    // Connect to RabbitMQ
    try {
        connection = createRabbitMQConnection(factory);
    } catch (IOException ex) {
        logger.error("Error creating RabbitMQ connection: {}", ex);
        return;
    }
    // Keep track of how many connections were opened
    sourceCounter.setOpenConnectionCount(sourceCounter.getOpenConnectionCount() + 1);
    // Open the channel
    try {
        channel = connection.createChannel();
    } catch (IOException ex) {
        logger.error("Error creating RabbitMQ channel: {}", ex);
        return;
    }
    // Set QoS Prefetching if enabled, exiting if it fails
    if (prefetchCount > 0) {
        if (!setQoS()) {
            this.close();
            return;
        }
    }
    // Create the new consumer and set the consumer tag
    consumer = new QueueingConsumer(channel);
    try {
        channel.basicConsume(queue, autoAck, consumer);
    } catch (IOException ex) {
        logger.error("Error starting consumer: {}", ex);
        counterGroup.incrementAndGet(COUNTER_EXCEPTION);
        this.close();
        return;
    }
    // Loop until shutdown is called
    while (!shutdown) {
        // Get the next message from the stack
        try {
            delivery = consumer.nextDelivery();
        } catch (InterruptedException ex) {
            logger.error("Consumer interrupted for {}, exiting: {}", this, ex);
            break;
        }
        sourceCounter.incrementEventReceivedCount();
        try {
            channelProcessor.processEvent(parseMessage(delivery));
        } catch (Exception ex) {
            logger.error("Error writing to channel for {}, message rejected {}", this, ex);
            rejectMessage(getDeliveryTag(delivery));
            continue;
        }
        sourceCounter.incrementEventAcceptedCount();
        ackMessage(getDeliveryTag(delivery));
    }
    // Tell RabbitMQ that the consumer is stopping
    cancelConsumer(consumer.getConsumerTag());
    // Cancel consumer
    this.close();
}

[Buggy Hunk]
ackMessage(getDeliveryTag(delivery));

[Patch]
if(!autoAck) ackMessage(getDeliveryTag(delivery));

[Demonstration 2]

[Buggy Method]
public String execute(Test test) {
    try {
        test.emergencyShutdown();
    } catch (ActionDataException | ActionException e1) {
        e1.printStackTrace();
        ;
        return "\n CRITICAL ERROR: CANNOT PERFORM EMERGENCY SHUTDOWN \n" + e1.getMessage();
    }
    return "\n could not run test";
}

[Buggy Hunk]
e1.printStackTrace();;

[Patch]
e1.printStackTrace();

[Demonstration 3]

[Buggy Method]
public static void main(String[] args) {
    loopEntries = new HashMap<Integer, LoopCommand>();
    int convert = -1;
    if (args.length < 1) {
        throw new IllegalArgumentException("Needs one script as argument.");
    } else if (args.length > 1) {
        switch(args[1]) {
            case convertToDuckyCommand:
                convert = 1;
                break;
            case convertToRobotCommand:
                convert = 2;
                break;
            case runDuckyCommand:
                convert = 3;
                break;
        }
    }
    MyRobot myRobot = null;
    File commandFile = new File(args[0]);
    BufferedReader reader = null;
    try {
        if (convert == -1) {
            reader = new BufferedReader(new FileReader(commandFile));
        } else if (convert == 1) {
            String script = ScriptConverter.convertToDucky(commandFile);
            File f = new File(commandFile.getName() + ".ducky");
            if (f.exists()) {
                f.delete();
            }
            f.createNewFile();
            PrintWriter pw = new PrintWriter(new FileWriter(f));
            pw.print(script);
            pw.flush();
            pw.close();
            System.out.println("Converted RobotScript " + commandFile.getName() + " to DuckyScript " + f.getName());
            System.exit(0);
        } else if (convert == 2) {
            String script = ScriptConverter.convertToRobot(commandFile);
            File f = new File(commandFile.getName() + ".robot");
            if (f.exists()) {
                f.delete();
            }
            f.createNewFile();
            PrintWriter pw = new PrintWriter(new FileWriter(f));
            pw.print(script);
            pw.flush();
            pw.close();
            System.out.println("Converted DuckyScript " + commandFile.getName() + " to RobotScript " + f.getName());
            System.exit(0);
        } else if (convert == 3) {
            String script = ScriptConverter.convertToRobot(commandFile);
            System.out.println(script);
            StringReader sr = new StringReader(script);
            reader = new BufferedReader(sr);
        }
    } catch (IOException exc) {
        exc.printStackTrace();
    }
    try {
        myRobot = new MyRobot();
    } catch (AWTException e) {
        e.printStackTrace();
    }
    //parse and execute script file//
    commands = FileParser.parseFile(reader, myRobot, new InputManager());
    for (cPointer = 0; cPointer < commands.size(); cPointer++) {
        Command c = commands.get(cPointer);
        if (!(c instanceof LoopCommand) && !(c instanceof EndLoopCommand)) {
            try {
                Thread.sleep(defaultDelay);
            } catch (InterruptedException exc) {
                exc.printStackTrace();
            }
        }
        c.execute();
    }
}

[Buggy Hunk]
if(!(c instanceof LoopCommand)&&!(c instanceof EndLoopCommand)){

[Patch]
if(!(c instanceof LoopCommand)&&!(c instanceof EndLoopCommand)&&defaultDelay!=0){