Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE when ResultSet is null #492

Closed
vladchuk opened this issue Oct 16, 2015 · 3 comments
Closed

NPE when ResultSet is null #492

vladchuk opened this issue Oct 16, 2015 · 3 comments
Assignees
Labels
Milestone

Comments

@vladchuk
Copy link

In the DefaultResultSetHandler, where rs is null (Oracle returns null RS in certain cases), a nasty NP exception is thrown (in the ResultSetWrapper) below:

private void handleRefCursorOutputParameter(ResultSet rs, ParameterMapping parameterMapping, MetaObject metaParam) throws SQLException {
try {
final String resultMapId = parameterMapping.getResultMapId();
final ResultMap resultMap = configuration.getResultMap(resultMapId);
final DefaultResultHandler resultHandler = new DefaultResultHandler(objectFactory);
final ResultSetWrapper rsw = new ResultSetWrapper(rs, configuration);
handleRowValues(rsw, resultMap, resultHandler, new RowBounds(), null);
metaParam.setValue(parameterMapping.getProperty(), resultHandler.getResultList());
} finally {
// issue #228 (close resultsets)
closeResultSet(rs);
}
}

It would be nice to have a check, something like:
if (rs != null) {
final ResultSetWrapper rsw = new ResultSetWrapper(rs, configuration);
handleRowValues(rsw, resultMap, rh, new RowBounds(), null);
}

Please fix or suggest a workaround - this really makes it impossible for us to use mybatis.

@elysrivero99
Copy link

+1

@harawata
Copy link
Member

Hi,

It should be fixed in the latest 3.4.0-SNAPSHOT.
As I don't have Oracle environment at hand, I would appreciate if you could test it with your solution.

Regards,
Iwao

@kazuki43zoo
Copy link
Member

Hi, @vladchuk
I want to know specific conditions for this error. Can you tell me ?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants