HHH-14727 Minor code cleanup in StandardSQLExceptionConverter

This commit is contained in:
Sanne Grinovero 2021-07-13 16:36:39 +01:00 committed by Sanne Grinovero
parent e4199decb5
commit 5616284a12
1 changed files with 3 additions and 10 deletions

View File

@ -19,22 +19,15 @@ import org.hibernate.exception.spi.SQLExceptionConverter;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
public class StandardSQLExceptionConverter implements SQLExceptionConverter { public class StandardSQLExceptionConverter implements SQLExceptionConverter {
private ArrayList<SQLExceptionConversionDelegate> delegates = new ArrayList<SQLExceptionConversionDelegate>();
private final ArrayList<SQLExceptionConversionDelegate> delegates = new ArrayList<SQLExceptionConversionDelegate>(4);
public StandardSQLExceptionConverter() { public StandardSQLExceptionConverter() {
} }
public StandardSQLExceptionConverter(SQLExceptionConversionDelegate... delegates) {
if ( delegates != null ) {
this.delegates.addAll( Arrays.asList( delegates ) );
}
}
public void addDelegate(SQLExceptionConversionDelegate delegate) { public void addDelegate(SQLExceptionConversionDelegate delegate) {
if ( delegate != null ) {
this.delegates.add( delegate ); this.delegates.add( delegate );
} }
}
@Override @Override
public JDBCException convert(SQLException sqlException, String message, String sql) { public JDBCException convert(SQLException sqlException, String message, String sql) {