Skip to content

No commit/rollback on Error #5

@witoldsz

Description

@witoldsz

The ThreadLocalTxManager has this method:

    @Override
    public <T> T txUnwrappedResult(UnitOfWorkCall<T> unit) throws Exception {
        begin();
        try {
            T result = unit.call();
            commit();
            return result;
        } catch (Exception e) {
            rollback();
            throw e;
        }
    }

Trouble is when unit throws an Error (for example: JUnit test with fail). The connection will not be released, there will be no commit or rollback.

In my very case, next test after the one which was calling fail was hanging forever because of this.

I think we need a finally clause here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions