diff --git a/src/main/java/org/apache/ibatis/binding/MapperMethod.java b/src/main/java/org/apache/ibatis/binding/MapperMethod.java index 570b98db5ec..69526229260 100644 --- a/src/main/java/org/apache/ibatis/binding/MapperMethod.java +++ b/src/main/java/org/apache/ibatis/binding/MapperMethod.java @@ -35,7 +35,6 @@ * @author Clinton Begin * @author Eduardo Macarron * @author Lasse Voss - * @author Kazuki Shimizu */ public class MapperMethod { @@ -246,7 +245,7 @@ public MethodSignature(Configuration configuration, Method method) { this.returnType = method.getReturnType(); this.returnsVoid = void.class.equals(this.returnType); this.returnsMany = (configuration.getObjectFactory().isCollection(this.returnType) || this.returnType.isArray()); - this.returnsCursor = Cursor.class.isAssignableFrom(this.returnType); + this.returnsCursor = Cursor.class.equals(this.returnType); this.mapKey = getMapKey(method); this.returnsMap = (this.mapKey != null); this.hasNamedParameters = hasNamedParams(method); diff --git a/src/main/java/org/apache/ibatis/cursor/defaults/DefaultCursor.java b/src/main/java/org/apache/ibatis/cursor/defaults/DefaultCursor.java index c2ce922c5ee..30c86afd7bb 100644 --- a/src/main/java/org/apache/ibatis/cursor/defaults/DefaultCursor.java +++ b/src/main/java/org/apache/ibatis/cursor/defaults/DefaultCursor.java @@ -16,8 +16,6 @@ package org.apache.ibatis.cursor.defaults; import org.apache.ibatis.cursor.Cursor; -import org.apache.ibatis.exceptions.ExceptionFactory; -import org.apache.ibatis.executor.ErrorContext; import org.apache.ibatis.executor.resultset.DefaultResultSetHandler; import org.apache.ibatis.executor.resultset.ResultSetWrapper; import org.apache.ibatis.mapping.ResultMap; @@ -33,7 +31,6 @@ /** * @author Guillaume Darmont / guillaume@dropinocean.com - * @author Kazuki Shimizu */ public class DefaultCursor implements Cursor { @@ -114,7 +111,7 @@ protected T fetchNextObjectFromDatabase() { opened = true; resultSetHandler.handleRowValues(rsw, resultMap, objectWrapperResultHandler, RowBounds.DEFAULT, null); } catch (SQLException e) { - ExceptionFactory.wrapException("Error fetching next object from database at the DefaultCursor.", e); + throw new RuntimeException(e); } T next = objectWrapperResultHandler.result; @@ -163,11 +160,7 @@ public CursorIterator() { @Override public boolean hasNext() { if (object == null) { - try { - object = fetchNextUsingRowBound(); - } finally { - ErrorContext.instance().reset(); - } + object = fetchNextUsingRowBound(); } return object != null; } @@ -178,11 +171,7 @@ public T next() { T next = object; if (next == null) { - try { - next = fetchNextUsingRowBound(); - } finally { - ErrorContext.instance().reset(); - } + next = fetchNextUsingRowBound(); } if (next != null) { diff --git a/src/test/java/org/apache/ibatis/submitted/cursor_nested/CreateDB.sql b/src/test/java/org/apache/ibatis/submitted/cursor_nested/CreateDB.sql index 575425d6465..ecf8f675cf9 100644 --- a/src/test/java/org/apache/ibatis/submitted/cursor_nested/CreateDB.sql +++ b/src/test/java/org/apache/ibatis/submitted/cursor_nested/CreateDB.sql @@ -1,6 +1,6 @@ -- --- Copyright 2009-2015 The MyBatis Team +-- Copyright 2009-2012 The MyBatis Team -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. diff --git a/src/test/java/org/apache/ibatis/submitted/cursor_nested/Mapper.xml b/src/test/java/org/apache/ibatis/submitted/cursor_nested/Mapper.xml index c06321f9942..0e0e35d2d44 100644 --- a/src/test/java/org/apache/ibatis/submitted/cursor_nested/Mapper.xml +++ b/src/test/java/org/apache/ibatis/submitted/cursor_nested/Mapper.xml @@ -1,6 +1,6 @@