[Demonstration 1]

[Buggy Method]
public Result newOffer(@LoggedInUser String username) {
    List<Career> careers = offerService.getCareers();
    List<OfferType> offerTypes = offerService.getOfferTypes();
    User user = userService.getUserById(username);
    List<OrganizationVO> organizations = null;
    Result result = Results.html();
    result.render("careers", careers);
    result.render("offerTypes", offerTypes);
    for (Role role : user.getRoles()) {
        if (role.getId() == UserRole.ADMINISTRADOR.getValue() || role.getId() == UserRole.ESTUDIANTE.getValue()) {
            organizations = userService.getOrganizations();
            result.render("organizations", organizations);
        }
    }
    return result;
}

[Buggy Hunk]
if(role.getId() == UserRole.ADMINISTRADOR.getValue() || role.getId() == UserRole.ESTUDIANTE.getValue()){

[Patch]
if(role.getId() == UserRole.ADMINISTRADOR.getValue() || role.getId() == ESTUDIANTE.getValue()){

[Demonstration 2]

[Buggy Method]
@Override
public byte[] getThumbnail(@PathParam("cineplexKey") String key) throws IOException, URISyntaxException {
    String remoteUrl = dao.selectByCineplexKey(key).getThumbnailImageUrl();
    // Do not deliver the not found images from our server as they contain
    // the Cineplex logo
    if (MISSING_THUMBNAIL_URL.equals(remoteUrl)) {
        throw new RedirectionException(Status.MOVED_PERMANENTLY, new URI(REPLACEMENT_MISSING_THUMBNAIL_URL));
    }
    URL remote = new URL(remoteUrl);
    InputStream stream = remote.openStream();
    byte[] r = IOUtils.toByteArray(stream);
    IOUtils.closeQuietly(stream);
    return r;
}

[Buggy Hunk]
public byte[] getThumbnail(@PathParam("cineplexKey") String key)

[Patch]
public byte[] getThumbnail(String key)

[Demonstration 3]

[Buggy Method]
@Override
public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
    //                Utils.d("onActionItemClicked " + item.getTitle());
    //risponde alla selezione di una azione del menu_comics_cab
    long menuId = item.getItemId();
    if (menuId == R.id.action_comics_delete) {
        long[] ags = mListView.getCheckedItemIds();
        //A0040
        //                    Long[] lgs = new Long[ags.length];
        //                    for (int ii = 0; ii < ags.length; ii++) {
        //                        lgs[ii] = ags[ii];
        //                    }
        //                    new RemoveComicsAsyncTask().execute(lgs);
        for (int ii = ags.length - 1; ii >= 0; ii--) {
            mAdapter.remove((int) ags[ii]);
        }
        getDataManager().notifyChanged(DataManager.CAUSE_COMICS_REMOVED);
        finishActionMode();
        return true;
    } else if (menuId == R.id.action_comics_share) {
        //A0034
        long[] ags = mListView.getCheckedItemIds();
        String[] rows = new String[ags.length];
        for (int ii = 0; ii < rows.length; ii++) {
            rows[ii] = getDataManager().getComics(ags[ii]).getName();
        }
        Intent sendIntent = new Intent();
        sendIntent.setAction(Intent.ACTION_SEND);
        sendIntent.putExtra(Intent.EXTRA_TEXT, Utils.join("\n", false, rows));
        sendIntent.setType("text/plain");
        startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.share)));
        return true;
    } else if (menuId == R.id.action_comics_search) {
        //A0042 cerco solo il primo elemento selezionato
        Comics comics = getDataManager().getComics(mListView.getCheckedItemIds()[0]);
        String query = Utils.join(" ", true, comics.getName(), comics.getAuthors(), comics.getPublisher());
        Intent intent = new Intent(Intent.ACTION_WEB_SEARCH);
        intent.putExtra(SearchManager.QUERY, query);
        startActivity(intent);
        return true;
    } else {
        return false;
    }
}

[Buggy Hunk]
mAdapter.remove((int) ags[ii]);

[Patch]
mAdapter.remove(ags[ii]);