You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by cb...@apache.org on 2009/10/17 17:54:01 UTC
svn commit: r826273 -
/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
Author: cbegin
Date: Sat Oct 17 15:54:00 2009
New Revision: 826273
URL: http://svn.apache.org/viewvc?rev=826273&view=rev
Log:
avoid NPE on closed executor.
Modified:
ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
Modified: ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java
URL: http://svn.apache.org/viewvc/ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java?rev=826273&r1=826272&r2=826273&view=diff
==============================================================================
--- ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java (original)
+++ ibatis/java/ibatis-3/trunk/ibatis-3-core/src/main/java/org/apache/ibatis/executor/BaseExecutor.java Sat Oct 17 15:54:00 2009
@@ -36,6 +36,7 @@
}
public Transaction getTransaction() {
+ if (closed) throw new ExecutorException("Executor was closed.");
return transaction;
}
@@ -59,17 +60,20 @@
public int update(MappedStatement ms, Object parameter) throws SQLException {
ErrorContext.instance().resource(ms.getResource()).activity("executing an update").object(ms.getId());
+ if (closed) throw new ExecutorException("Executor was closed.");
localCache.clear();
return doUpdate(ms, parameter);
}
public List flushStatements() throws SQLException {
+ if (closed) throw new ExecutorException("Executor was closed.");
batchResults.addAll(doFlushStatements());
return batchResults;
}
public List query(MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler) throws SQLException {
ErrorContext.instance().resource(ms.getResource()).activity("executing a query").object(ms.getId());
+ if (closed) throw new ExecutorException("Executor was closed.");
List list;
try {
queryStack++;
@@ -97,10 +101,12 @@
}
public void deferLoad(MappedStatement ms, MetaObject resultObject, String property, CacheKey key) {
+ if (closed) throw new ExecutorException("Executor was closed.");
deferredLoads.add(new DeferredLoad(ms, resultObject, property, key));
}
public CacheKey createCacheKey(MappedStatement ms, Object parameterObject, RowBounds rowBounds) {
+ if (closed) throw new ExecutorException("Executor was closed.");
BoundSql boundSql = ms.getBoundSql(parameterObject);
CacheKey cacheKey = new CacheKey();
cacheKey.update(ms.getId());