mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
bug fixed for mysql driver 6.0 xa support.
This commit is contained in:
@@ -121,10 +121,10 @@ public class MySqlUtils {
|
||||
// pinGlobalTxToPhysicalConnection
|
||||
boolean pinGlobTx = (Boolean) method_6_getValue.invoke(
|
||||
method_6_getBooleanReadableProperty.invoke(
|
||||
method_6_getPropertySet.invoke(physicalConn)
|
||||
, "pinGlobalTxToPhysicalConnection"
|
||||
method_6_getPropertySet.invoke(physicalConn)
|
||||
, "pinGlobalTxToPhysicalConnection"
|
||||
)
|
||||
);
|
||||
);
|
||||
|
||||
if (pinGlobTx) {
|
||||
try {
|
||||
@@ -151,6 +151,11 @@ public class MySqlUtils {
|
||||
}
|
||||
return (XAConnection) method_6_getInstanceXA.invoke(null, physicalConn, Boolean.FALSE);
|
||||
}
|
||||
} catch (InvocationTargetException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof RuntimeException) {
|
||||
throw (RuntimeException) cause;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
method_6_getInstance_error = true;
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.lang.reflect.Constructor;
|
||||
import java.sql.Connection;
|
||||
|
||||
public class MySqlUtilsTest extends TestCase {
|
||||
public void test_() throws Exception {
|
||||
public void test_xa() throws Exception {
|
||||
Driver driver = new Driver();
|
||||
int majorVersion = driver.getMajorVersion();
|
||||
|
||||
@@ -23,7 +23,11 @@ public class MySqlUtilsTest extends TestCase {
|
||||
Constructor<?> constructor = clazz_ConnectionImpl.getDeclaredConstructor();
|
||||
constructor.setAccessible(true);
|
||||
Connection conn = (Connection) constructor.newInstance();
|
||||
MySqlUtils.createXAConnection(driver, conn);
|
||||
try {
|
||||
MySqlUtils.createXAConnection(driver, conn);
|
||||
} catch (NullPointerException ex) {
|
||||
//skip
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user