Commit 4ea816c 1 parent 2148f8c commit 4ea816c Copy full SHA for 4ea816c
File tree 1 file changed +3
-4
lines changed
src/main/java/it/gov/pagopa/node/cfg_sync/exception
1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -152,10 +152,9 @@ public ResponseEntity<ProblemJson> handleDataIntegrityViolationException(
152
152
final DataIntegrityViolationException ex , final WebRequest request ) {
153
153
ProblemJson errorResponse = null ;
154
154
155
- if (ex .getCause () instanceof ConstraintViolationException ) {
156
- String sqlState = ((ConstraintViolationException ) ex .getCause ()).getSQLState ();
157
- var errorCode = ((ConstraintViolationException ) ex .getCause ()).getSQLException ()
158
- .getErrorCode ();
155
+ if (ex .getCause () instanceof ConstraintViolationException constraintViolationException ) {
156
+ String sqlState = constraintViolationException .getSQLState ();
157
+ var errorCode = constraintViolationException .getSQLException ().getErrorCode ();
159
158
// check the reason of ConstraintViolationException: is true if the object is referenced by a foreign key
160
159
// more info: https://docs.oracle.com/javadb/10.8.3.0/ref/rrefexcept71493.html
161
160
if (sqlState .equals (FOREIGN_KEY_VIOLATION )) {
You can’t perform that action at this time.
0 commit comments