Skip to content

Commit b5db108

Browse files
committed
#204 - Polishing.
Fix unwrapping in CloseSuppressingInvocationHandler. Remove unused conditional branches.
1 parent b5ac43b commit b5db108

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/main/java/org/springframework/data/r2dbc/core/DefaultDatabaseClient.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ private static String getRequiredSql(Supplier<String> sqlSupplier) {
14731473
*
14741474
* @see Connection#close()
14751475
*/
1476-
private class CloseSuppressingInvocationHandler implements InvocationHandler {
1476+
private static class CloseSuppressingInvocationHandler implements InvocationHandler {
14771477

14781478
private final Connection target;
14791479

@@ -1493,13 +1493,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
14931493
// Use hashCode of PersistenceManager proxy.
14941494
return System.identityHashCode(proxy);
14951495
} else if (method.getName().equals("unwrap")) {
1496-
if (((Class<?>) args[0]).isInstance(proxy)) {
1497-
return proxy;
1498-
}
1499-
} else if (method.getName().equals("isWrapperFor")) {
1500-
if (((Class<?>) args[0]).isInstance(proxy)) {
1501-
return true;
1502-
}
1496+
return target;
15031497
} else if (method.getName().equals("close")) {
15041498
// Handle close method: suppress, not valid.
15051499
return Mono.error(new UnsupportedOperationException("Close is not supported!"));

0 commit comments

Comments
 (0)