diff --git a/src/main/java/com/zaxxer/hikari/pool/PoolBase.java b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java index 7be2fb5f..63905c75 100644 --- a/src/main/java/com/zaxxer/hikari/pool/PoolBase.java +++ b/src/main/java/com/zaxxer/hikari/pool/PoolBase.java @@ -171,28 +171,35 @@ abstract class PoolBase void resetConnectionState(final Connection connection, final ProxyConnection proxyConnection, final int dirtyBits) throws SQLException { + int resetBits = 0; + if ((dirtyBits & DIRTY_BIT_READONLY) != 0 && proxyConnection.getReadOnlyState() != isReadOnly) { connection.setReadOnly(isReadOnly); + resetBits |= DIRTY_BIT_READONLY; } if ((dirtyBits & DIRTY_BIT_AUTOCOMMIT) != 0 && proxyConnection.getAutoCommitState() != isAutoCommit) { connection.setAutoCommit(isAutoCommit); + resetBits |= DIRTY_BIT_AUTOCOMMIT; } if ((dirtyBits & DIRTY_BIT_ISOLATION) != 0 && proxyConnection.getTransactionIsolationState() != transactionIsolation) { connection.setTransactionIsolation(transactionIsolation); + resetBits |= DIRTY_BIT_ISOLATION; } if ((dirtyBits & DIRTY_BIT_CATALOG) != 0 && catalog != null && !catalog.equals(proxyConnection.getCatalogState())) { connection.setCatalog(catalog); + resetBits |= DIRTY_BIT_CATALOG; } if ((dirtyBits & DIRTY_BIT_NETTIMEOUT) != 0 && proxyConnection.getNetworkTimeoutState() != networkTimeout) { setNetworkTimeout(connection, networkTimeout); + resetBits |= DIRTY_BIT_NETTIMEOUT; } - if (dirtyBits != 0 && LOGGER.isDebugEnabled()) { - LOGGER.debug("{} - Reset ({}) on connection {}", poolName, stringFromResetBits(dirtyBits), connection); + if (resetBits != 0 && LOGGER.isDebugEnabled()) { + LOGGER.debug("{} - Reset ({}) on connection {}", poolName, stringFromResetBits(resetBits), connection); } } diff --git a/src/main/java/com/zaxxer/hikari/util/PropertyElf.java b/src/main/java/com/zaxxer/hikari/util/PropertyElf.java index c5dc9d25..c7b03ff3 100644 --- a/src/main/java/com/zaxxer/hikari/util/PropertyElf.java +++ b/src/main/java/com/zaxxer/hikari/util/PropertyElf.java @@ -81,7 +81,7 @@ public final class PropertyElf Matcher matcher = GETTER_PATTERN.matcher(""); for (Method method : targetClass.getMethods()) { String name = method.getName(); - if (method.getParameterCount() == 0 && matcher.reset(name).matches()) { + if (method.getParameterTypes().length == 0 && matcher.reset(name).matches()) { name = name.replaceFirst("(get|is)", ""); try { if (targetClass.getMethod("set" + name, method.getReturnType()) != null) { @@ -132,7 +132,7 @@ public final class PropertyElf String methodName = "set" + propName.substring(0, 1).toUpperCase() + propName.substring(1); for (Method method : methods) { - if (method.getParameterCount() == 1 && method.getName().equals(methodName)) { + if (method.getName().equals(methodName) && method.getParameterTypes().length == 1) { writeMethod = method; break; } @@ -141,7 +141,7 @@ public final class PropertyElf if (writeMethod == null) { methodName = "set" + propName.toUpperCase(); for (Method method : methods) { - if (method.getParameterCount() == 1 && method.getName().equals(methodName)) { + if (method.getName().equals(methodName) && method.getParameterTypes().length == 1) { writeMethod = method; break; }