Skip to content

Commit 3d430e1

Browse files
leizhiyuangithub-ygy
authored andcommitted
fix bug for non SQLException not thrown (#834)
1 parent e9bb3e6 commit 3d430e1

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

rm-datasource/src/main/java/io/seata/rm/datasource/exec/ExecuteTemplate.java

+6-7
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ public static <T, S extends Statement> T execute(SQLRecognizer sqlRecognizer,
7272

7373
if (sqlRecognizer == null) {
7474
sqlRecognizer = SQLVisitorFactory.get(
75-
statementProxy.getTargetSQL(),
76-
statementProxy.getConnectionProxy().getDbType());
75+
statementProxy.getTargetSQL(),
76+
statementProxy.getConnectionProxy().getDbType());
7777
}
7878
Executor<T> executor = null;
7979
if (sqlRecognizer == null) {
@@ -102,12 +102,11 @@ public static <T, S extends Statement> T execute(SQLRecognizer sqlRecognizer,
102102
rs = executor.execute(args);
103103

104104
} catch (Throwable ex) {
105-
if (ex instanceof SQLException) {
106-
throw (SQLException)ex;
107-
} else {
108-
// Turn everything into SQLException
109-
new SQLException(ex);
105+
if (!(ex instanceof SQLException)) {
106+
// Turn other exception into SQLException
107+
ex = new SQLException(ex);
110108
}
109+
throw (SQLException)ex;
111110
}
112111
return rs;
113112
}

0 commit comments

Comments
 (0)