[Demonstration 1]

[Buggy Method]
private void loop() {
    long lastLoopTime = System.nanoTime();
    final int TARGET_FPS = 60;
    final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;
    while (running) {
        long now = System.nanoTime();
        long updateLength = now - lastLoopTime;
        lastLoopTime = now;
        double delta = updateLength / ((double) OPTIMAL_TIME);
        lastFpsTime += updateLength;
        fps++;
        if (lastFpsTime >= 1000000000) {
            System.out.println("(FPS: " + fps + ")");
            System.out.println("(DELTA: " + delta + " ms)");
            lastFpsTime = 0;
            fps = 0;
        }
        if (setup) {
            draw(delta);
            this.repaint();
        }
        try {
            Thread.sleep((lastLoopTime - System.nanoTime() + OPTIMAL_TIME) / 1000000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

[Buggy Hunk]
Thread.sleep( (lastLoopTime-System.nanoTime() + OPTIMAL_TIME)/1000000);

[Patch]
Thread.sleep( Math.abs((lastLoopTime-System.nanoTime() + OPTIMAL_TIME)/1000000));

[Demonstration 2]

[Buggy Method]
public void testCreateOneDocumentNotificationAndGetInfo() throws IOException, JSONException {
    log.debug("NotificationsTest.testCreateThreeDocumentNotificationsForUserOne");
    JSONArray returnJSON;
    NodeRef ref = TestUtils.uploadFile(transactionService, contentService, fileFolderService, sites.get(TestUtils.SITE_THREE).getNodeRef());
    returnJSON = assertAddNewDocumentNotification(TestUtils.USER_ONE, TestUtils.SITE_THREE, ref);
    String nodeRef = getNodeRef(returnJSON);
    assertGetInfo(nodeRef, TestUtils.SITE_THREE);
}

[Buggy Hunk]
NodeRef ref = TestUtils.uploadFile(transactionService, contentService, fileFolderService, sites.get(TestUtils.SITE_THREE).getNodeRef());

[Patch]
NodeRef ref = TestUtils.uploadFile(transactionService, contentService, fileFolderService, siteThree.getNodeRef());

[Demonstration 3]

[Buggy Method]
private void fillOptions(final CompilerOptions options, final List<String> filenames, List<String> args) {
    if (filenames != null) {
        args.addAll(filenames);
    }
    if (options != null) {
        if (options.isAllowJs()) {
            args.add("--allowJs");
        }
        if (options.isListFiles()) {
            args.add("--listFiles");
        }
        if (!StringUtils.isEmpty(options.getMapRoot())) {
            args.add("--mapRoot");
            args.add(options.getMapRoot());
        }
        if (!StringUtils.isEmpty(options.getOutDir())) {
            args.add("--outDir");
            args.add(options.getOutDir());
        }
        if (options.isSourceMap()) {
            args.add("--sourceMap");
        }
        if (!StringUtils.isEmpty(options.getSourceRoot())) {
            args.add("--sourceRoot");
            args.add(options.getSourceRoot());
        }
        if (options.isTraceResolution()) {
            args.add("--traceResolution");
        }
        Boolean watch = options.isWatch();
        if (watch != null && watch) {
            args.add("--watch");
        }
    }
}

[Buggy Hunk]
if (options.isAllowJs()) {

[Patch]
if (options.isAllowJs() != null && options.isAllowJs()) {