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

Possible occur NullpointerException on MyBatisCursorItemReader when close #237

kazuki43zoo opened this Issue Oct 10, 2017 · 0 comments


None yet
1 participant

kazuki43zoo commented Oct 10, 2017

In the current implementation of MyBatisCursorItemReader, there is possible that NullpointerException occurs when implements application code as follow:

Application code:

try {;
    // ...
} finally {


protected void doOpen() throws Exception {
  Map<String, Object> parameters = new HashMap<>();
  if (parameterValues != null) {

  sqlSession = sqlSessionFactory.openSession(ExecutorType.SIMPLE);  
  cursor = sqlSession.selectCursor(queryId, parameters); // <- when occurs exception, a cursor is null
  cursorIterator = cursor.iterator();

protected void doClose() throws Exception {
  cursor.close(); // <- occurs NullpointerException
  cursorIterator = null;

@kazuki43zoo kazuki43zoo added the bug label Oct 10, 2017

@kazuki43zoo kazuki43zoo added this to the 1.3.2 milestone Oct 10, 2017

kazuki43zoo added a commit to kazuki43zoo/spring that referenced this issue Oct 10, 2017

@kazuki43zoo kazuki43zoo self-assigned this Oct 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment