[Demonstration 1]

[Buggy Method]
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
    Log.d("WebViewClient", "loading " + url);
    boolean completed = false;
    if (url.contains(PaymentArguments.EXT_AUTH_SUCCESS_URI)) {
        completed = true;
        hideWebView();
        proceed();
    } else if (url.contains(PaymentArguments.EXT_AUTH_FAIL_URI)) {
        completed = true;
        showError(Error.AUTHORIZATION_REJECT, null);
    }
    if (completed) {
        hideProgressBar();
    }
    return completed || super.shouldOverrideUrlLoading(view, url);
}

[Buggy Hunk]
hideWebView();

[Patch]
webView.setVisibility(View.GONE);

[Demonstration 2]

[Buggy Method]
@Override
public void call(Subscriber<? super List<Address>> subscriber) {
    Geocoder geocoder = new Geocoder(ctx);
    List<Address> result;
    try {
        if (bounds != null) {
            result = geocoder.getFromLocationName(locationName, maxResults, bounds.southwest.latitude, bounds.southwest.longitude, bounds.northeast.latitude, bounds.northeast.longitude);
        } else {
            result = geocoder.getFromLocationName(locationName, maxResults);
        }
        if (subscriber.isUnsubscribed()) {
            subscriber.onNext(result);
            subscriber.onCompleted();
        }
    } catch (IOException e) {
        if (!subscriber.isUnsubscribed()) {
            subscriber.onError(e);
        }
    }
}

[Buggy Hunk]
if (subscriber.isUnsubscribed()) {

[Patch]
if (!subscriber.isUnsubscribed()) {

[Demonstration 3]

[Buggy Method]
protected void UpdateRoutes(ArrayList<Route> NewRoutes) throws IOException {
    System.out.println("Updating routes");
    double oldCost, newCost;
    boolean BetterRouteFound = false;
    // Loop through the new routes
    for (int newRouteNum = 0; newRouteNum < NewRoutes.size(); newRouteNum++) {
        // Get the current new route
        Route CurrentNewRoute = NewRoutes.get(newRouteNum);
        System.out.println("Evaluating route: " + CurrentNewRoute);
        // Search for an existing route to the destination in the new route
        Route oldRoute = FindRoute(CurrentNewRoute.Destination.Name);
        // Get the existing route to the new route source router
        Route routeToSource = FindRoute(CurrentNewRoute.Source.Name);
        // Calculate the new route cost
        newCost = routeToSource.Cost + CurrentNewRoute.Cost;
        // If an existing route to the destination was not found
        if (oldRoute == null) {
            // Add the new route
            Route routeAdd = new Route();
            routeAdd.Cost = newCost;
            routeAdd.Source = ThisRouter;
            routeAdd.Destination = CurrentNewRoute.Destination;
            routeAdd.NextRouter = routeToSource.Destination;
            Routes.add(routeAdd);
            BetterRouteFound = true;
            System.out.println("Added new route: " + routeAdd);
        } else // Otherwise, evaluate the new route compared to the existing route
        {
            // Get the existing route cost
            oldCost = oldRoute.Cost;
            System.out.println("Existing route cost is " + oldCost + ", new route cost is " + newCost);
            // If the new cost is less than the existing cost
            if (newCost < oldCost) {
                // Update the existing route to use the new route
                oldRoute.Cost = newCost;
                oldRoute.NextRouter = CurrentNewRoute.Source;
                BetterRouteFound = true;
                System.out.println("Updated existing route: " + oldRoute);
            } else // Otherwise, the existing route cost is better
            {
                System.out.println("Existing route cost is equal or better, no update performed");
            }
        }
    }
    System.out.println("Updating routes complete");
    System.out.println();
    // Print the current routing table
    PrintRoutingTable();
    // Check if a better route was found during the updates
    if (BetterRouteFound) {
        // If so, immediately send a broadcast
        System.out.println("Better route found, sending broadcast");
        Broadcast();
        // Reset the timer
        BroadcastTimer.cancel();
        BroadcastTimer = new Timer();
        BroadcastTimer.scheduleAtFixedRate(new TimerTask() {

            @Override
            public void run() {
                try {
                    Broadcast();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }, BroadcastInterval, BroadcastInterval);
    }
}

[Buggy Hunk]
protected void UpdateRoutes( ArrayList<Route> NewRoutes ) throws IOException

[Patch]
synchronized protected void UpdateRoutes( ArrayList<Route> NewRoutes ) throws IOException