Skip to content

Commit cd31127

Browse files
committed
Polish contribution
See gh-44954
1 parent 6801b1a commit cd31127

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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 SQLErrorCodeSQLExceptionTranslator();
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -94,6 +94,7 @@ private ExecuteContext mockContext(SQLDialect dialect, SQLException sqlException
9494

9595
static Object[] exceptionTranslatesSqlExceptions() {
9696
return new Object[] { new Object[] { SQLDialect.DERBY, sqlException("42802") },
97+
new Object[] { SQLDialect.DERBY, new SQLSyntaxErrorException() },
9798
new Object[] { SQLDialect.H2, sqlException(42000) },
9899
new Object[] { SQLDialect.H2, new SQLSyntaxErrorException() },
99100
new Object[] { SQLDialect.HSQLDB, sqlException(-22) },
@@ -104,9 +105,8 @@ static Object[] exceptionTranslatesSqlExceptions() {
104105
new Object[] { SQLDialect.MYSQL, new SQLSyntaxErrorException() },
105106
new Object[] { SQLDialect.POSTGRES, sqlException("03000") },
106107
new Object[] { SQLDialect.POSTGRES, new SQLSyntaxErrorException() },
107-
new Object[] { SQLDialect.SQLITE, new SQLSyntaxErrorException() },
108108
new Object[] { SQLDialect.SQLITE, sqlException("21000") },
109-
};
109+
new Object[] { SQLDialect.SQLITE, new SQLSyntaxErrorException() } };
110110
}
111111

112112
private static SQLException sqlException(String sqlState) {

0 commit comments

Comments
 (0)