[Demonstration 1]

[Buggy Method]
public void shrink(PlantView p) {
    affected.add(p);
    if (health / (affected.size() * 2) == 0) {
        this.Stopping = true;
    } else {
        //change image width with health
        wimg = new ImageIcon(water.getScaledInstance((int) (health / (affected.size() * (1.75))), 100, 20));
        this.getWbutton().setIcon(wimg);
        this.getWbutton().setSize((int) (health / (affected.size() * (1.75))), 100);
    }
}

[Buggy Hunk]
if(health/(affected.size()*2)==0){

[Patch]
if(affected.size()==0){

[Demonstration 2]

[Buggy Method]
public void filter(final Event event, boolean write) throws Event, Exception {
    for (int i = 0; i < size(); i++) {
        final Service service = (Service) get(i);
        if (event.daemon().timeout > 0 && !event.headless) {
            event.session(service, event);
        }
        long cpu = Event.bean.getThreadCpuTime(Thread.currentThread().getId());
        if (event.daemon().host) {
            try {
                final Deploy.Archive archive = event.daemon().archive(event.query().header("host"), true);
                try {
                    Thread.currentThread().setContextClassLoader(archive);
                } catch (AccessControlException e) {
                    // recursive chaining fails here, no worries! ;)
                }
                Object o = AccessController.doPrivileged(new PrivilegedExceptionAction() {

                    public Object run() throws Exception {
                        try {
                            service.filter(event);
                            return null;
                        } catch (Event event) {
                            return event;
                        }
                    }
                }, archive.access());
                if (o != null) {
                    throw (Event) o;
                }
            } catch (PrivilegedActionException e) {
                if (e.getCause() != null) {
                    throw (Exception) e.getCause();
                } else {
                    throw e;
                }
            }
        } else {
            service.filter(event);
        }
        String path = event.query().path();
        Daemon.Metric metric = (Daemon.Metric) service.metric.get(path);
        if (metric == null) {
            metric = new Daemon.Metric();
            service.metric.put(path, metric);
        }
        if (i == 0) {
            if (!write)
                metric.req.in++;
            metric.req.out++;
        }
        metric.cpu += Event.bean.getThreadCpuTime(Thread.currentThread().getId()) - cpu;
        metric.net.in += event.query().input.total;
        metric.net.out += event.reply().output.total;
        //System.out.println("add " + metric.hashCode() + " " + metric);
        event.query().input.total = 0;
        event.reply().output.total = 0;
    }
}

[Buggy Hunk]
public void filter(final Event event, boolean write) throws Event, Exception {

[Patch]
protected void filter(final Event event, boolean write) throws Event, Exception {

[Demonstration 3]

[Buggy Method]
public void setHealth(int health) {
    this.health = health;
}

[Buggy Hunk]
this.health = health;

[Patch]
this.health = this.health - health;