[Demonstration 1]

[Buggy Method]
public final void handleObjectCommand(final ObjectCommand command, final StreamSource source) throws IOException {
    Option<EveStructuredObject> result = findById(command.getObjectId());
    EveStructuredObjectCommand objectCommand = command.getObjectCommand();
    ObjectMapper mapper = getMapper();
    EveStructuredObject o = result.isDefined() ? result.get() : null;
    try {
        if (objectCommand instanceof GetTypeCommand) {
            String type = (o != null) ? o.getType() : "";
            source.writeStringResponse(type);
        } else if (objectCommand instanceof GetFieldCommand) {
            String field = ((GetFieldCommand) objectCommand).getField();
            Option<EveObject> value = (o != null) ? o.get(field) : Option.<EveObject>empty();
            source.writeResultResponse(mapper, Conversions.toResult(value));
        } else if (objectCommand instanceof SetFieldCommand) {
            SetFieldCommand cmd = (SetFieldCommand) objectCommand;
            if (o != null) {
                o.set(cmd.getField(), cmd.getValue());
            }
        } else if (objectCommand instanceof HasFieldCommand) {
            String field = ((HasFieldCommand) objectCommand).getField();
            boolean has = (o != null) ? o.has(field) : false;
            source.writeBooleanResponse(has);
        } else if (objectCommand instanceof GetStateCommand) {
            String field = ((GetStateCommand) objectCommand).getField();
            Option<String> value = (o != null) ? o.getState(field) : Option.<String>empty();
            source.writeResultResponse(mapper, Conversions.toResult(value));
        } else if (objectCommand instanceof SetStateCommand) {
            SetStateCommand cmd = (SetStateCommand) objectCommand;
            if (o != null) {
                o.setState(cmd.getField(), cmd.getValue());
            }
        } else if (objectCommand instanceof HasStateCommand) {
            String field = ((HasStateCommand) objectCommand).getField();
            boolean has = (o != null) ? o.hasState(field) : false;
            source.writeBooleanResponse(has);
        } else if (objectCommand instanceof CallActionCommand) {
            IAction.ActionType action = ((CallActionCommand) objectCommand).getAction();
            boolean returnedValue = (o != null) ? o.call(action) : false;
            source.writeBooleanResponse(returnedValue);
        }
    } catch (IOException e) {
    }
}

[Buggy Hunk]
IAction.ActionType action = ((CallActionCommand) objectCommand).getAction();

[Patch]
IAction action = ((CallActionCommand) objectCommand).getAction();

[Demonstration 2]

[Buggy Method]
@Override
public void run() {
    int count = mLoadMoreView.getViewCount();
    Log.d("DEBUG", "count " + count);
    for (int i = count - 1; i < (count - 1 + LoadMoreView.LOAD_VIEW_SET_COUNT) && mFeedList.size() > i; i++) {
        mLoadMoreView.addView(new PhotoView(mLoadMoreView.getContext(), mFeedList.get(i), mUserId, mUserName));
        if (i == mFeedList.size() - 1) {
            mLoadMoreView.noMoreToLoad();
            break;
        }
    }
    mLoadMoreView.loadingDone();
}

[Buggy Hunk]
mFeedList.get(i), mUserId, mUserName));

[Patch]
mFeedList.get(i), mUserId, mUserName, mLoadMoreView));

[Demonstration 3]

[Buggy Method]
public void setBigDecimal(final int pos, final BigDecimal val) throws SQLException {
    stmt.setBigDecimal(pos, val);
}

[Buggy Hunk]
stmt.setBigDecimal(pos, val);

[Patch]
stmt.setBigDecimal(pos, val == null ? BigDecimal.ZERO : val);