Skip to content

Commit e8ddb93

Browse files
committed
Merge branch '3.4.x'
Closes gh-45220
2 parents 446a961 + e35cd81 commit e8ddb93

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Diff for: spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jooq/DefaultExceptionTranslatorExecuteListener.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626

2727
import org.springframework.dao.DataAccessException;
2828
import org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator;
29+
import org.springframework.jdbc.support.SQLExceptionSubclassTranslator;
2930
import org.springframework.jdbc.support.SQLExceptionTranslator;
30-
import org.springframework.jdbc.support.SQLStateSQLExceptionTranslator;
3131
import org.springframework.util.Assert;
3232

3333
/**
@@ -114,7 +114,7 @@ public SQLExceptionTranslator apply(ExecuteContext context) {
114114
private SQLExceptionTranslator apply(SQLDialect dialect) {
115115
String dbName = getSpringDbName(dialect);
116116
return (dbName != null) ? new SQLErrorCodeSQLExceptionTranslator(dbName)
117-
: new SQLStateSQLExceptionTranslator();
117+
: new SQLExceptionSubclassTranslator();
118118
}
119119

120120
private String getSpringDbName(SQLDialect dialect) {

Diff for: spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/jooq/DefaultExceptionTranslatorExecuteListenerTests.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.boot.autoconfigure.jooq;
1818

1919
import java.sql.SQLException;
20+
import java.sql.SQLSyntaxErrorException;
2021
import java.util.function.Function;
2122

2223
import org.jooq.Configuration;
@@ -93,12 +94,19 @@ private ExecuteContext mockContext(SQLDialect dialect, SQLException sqlException
9394

9495
static Object[] exceptionTranslatesSqlExceptions() {
9596
return new Object[] { new Object[] { SQLDialect.DERBY, sqlException("42802") },
97+
new Object[] { SQLDialect.DERBY, new SQLSyntaxErrorException() },
9698
new Object[] { SQLDialect.H2, sqlException(42000) },
99+
new Object[] { SQLDialect.H2, new SQLSyntaxErrorException() },
97100
new Object[] { SQLDialect.HSQLDB, sqlException(-22) },
101+
new Object[] { SQLDialect.HSQLDB, new SQLSyntaxErrorException() },
98102
new Object[] { SQLDialect.MARIADB, sqlException(1054) },
103+
new Object[] { SQLDialect.MARIADB, new SQLSyntaxErrorException() },
99104
new Object[] { SQLDialect.MYSQL, sqlException(1054) },
105+
new Object[] { SQLDialect.MYSQL, new SQLSyntaxErrorException() },
100106
new Object[] { SQLDialect.POSTGRES, sqlException("03000") },
101-
new Object[] { SQLDialect.SQLITE, sqlException("21000") } };
107+
new Object[] { SQLDialect.POSTGRES, new SQLSyntaxErrorException() },
108+
new Object[] { SQLDialect.SQLITE, sqlException("21000") },
109+
new Object[] { SQLDialect.SQLITE, new SQLSyntaxErrorException() } };
102110
}
103111

104112
private static SQLException sqlException(String sqlState) {

0 commit comments

Comments
 (0)