Skip to content

Commit c5bcfc7

Browse files
committed
Polish contribution
See gh-31554
1 parent 5752e03 commit c5bcfc7

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

spring-jdbc/src/main/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ public class SQLStateSQLExceptionTranslator extends AbstractFallbackSQLException
9090
);
9191

9292
private static final Set<Integer> DUPLICATE_KEY_ERROR_CODES = Set.of(
93-
1, // Oracle
94-
301, // Sap Hana
93+
1, // Oracle
94+
301, // SAP HANA
9595
1062, // MySQL/MariaDB
9696
2601, // MS SQL Server
9797
2627 // MS SQL Server
@@ -163,12 +163,12 @@ private String getSqlState(SQLException ex) {
163163

164164

165165
/**
166-
* Check whether the given SQL state (and the associated error code in case
166+
* Check whether the given SQL state and the associated error code (in case
167167
* of a generic SQL state value) indicate a {@link DuplicateKeyException}:
168168
* either SQL state 23505 as a specific indication, or the generic SQL state
169-
* 23000 with well-known vendor codes.
169+
* 23000 with a well-known vendor code.
170170
* @param sqlState the SQL state value
171-
* @param errorCode the error code value
171+
* @param errorCode the error code
172172
*/
173173
static boolean indicatesDuplicateKey(@Nullable String sqlState, int errorCode) {
174174
return ("23505".equals(sqlState) ||

spring-jdbc/src/test/java/org/springframework/jdbc/support/SQLStateSQLExceptionTranslatorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void translateDuplicateKeyMSSQL2() {
8484
assertTranslation("23000", 2627, DuplicateKeyException.class);
8585
}
8686

87-
@Test
87+
@Test // gh-31554
8888
void translateDuplicateKeySapHana() {
8989
assertTranslation("23000", 301, DuplicateKeyException.class);
9090
}

0 commit comments

Comments
 (0)