Skip to content

Commit 9d6245f

Browse files
committed
Minor fixes
1 parent 20f8f7b commit 9d6245f

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/main/java/org/apache/ibatis/binding/MapperProxy.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2013 the original author or authors.
2+
* Copyright 2009-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,7 @@
2020
import java.lang.reflect.Method;
2121
import java.util.Map;
2222

23+
import org.apache.ibatis.reflection.ExceptionUtil;
2324
import org.apache.ibatis.session.SqlSession;
2425

2526
public class MapperProxy<T> implements InvocationHandler, Serializable {
@@ -37,7 +38,11 @@ public MapperProxy(SqlSession sqlSession, Class<T> mapperInterface, Map<Method,
3738

3839
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
3940
if (Object.class.equals(method.getDeclaringClass())) {
40-
return method.invoke(this, args);
41+
try {
42+
return method.invoke(this, args);
43+
} catch (Throwable t) {
44+
throw ExceptionUtil.unwrapThrowable(t);
45+
}
4146
}
4247
final MapperMethod mapperMethod = cachedMapperMethod(method);
4348
return mapperMethod.execute(sqlSession, args);

src/main/java/org/apache/ibatis/datasource/pooled/PooledConnection.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2009-2012 the original author or authors.
2+
* Copyright 2009-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -228,17 +228,15 @@ public boolean equals(Object obj) {
228228
* @param args - the parameters to be passed to the method
229229
* @see java.lang.reflect.InvocationHandler#invoke(Object, java.lang.reflect.Method, Object[])
230230
*/
231-
public Object invoke(Object proxy, Method method, Object[] args)
232-
throws Throwable {
231+
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
233232
String methodName = method.getName();
234233
if (CLOSE.hashCode() == methodName.hashCode() && CLOSE.equals(methodName)) {
235234
dataSource.pushConnection(this);
236235
return null;
237236
} else {
238237
try {
239-
if (method.getDeclaringClass() != Object.class) {
240-
// issue #578.
241-
// toString() should never fail
238+
if (!Object.class.equals(method.getDeclaringClass())) {
239+
// issue #579 toString() should never fail
242240
// throw an SQLException instead of a Runtime
243241
checkConnection();
244242
}

0 commit comments

Comments
 (0)