From: Juergen H. <jho...@us...> - 2008-10-16 19:30:23
|
Update of /cvsroot/springframework/spring/src/org/springframework/jdbc/support In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv25115/src/org/springframework/jdbc/support Modified Files: Tag: mbranch-2-0 SQLErrorCodeSQLExceptionTranslator.java CustomSQLErrorCodesTranslation.java Log Message: SQLErrorCodeSQLExceptionTranslator is able to work without fallback SQLState translation as well Index: CustomSQLErrorCodesTranslation.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/support/CustomSQLErrorCodesTranslation.java,v retrieving revision 1.4 retrieving revision 1.4.6.1 diff -C2 -d -r1.4 -r1.4.6.1 *** CustomSQLErrorCodesTranslation.java 25 Mar 2005 09:27:10 -0000 1.4 --- CustomSQLErrorCodesTranslation.java 16 Oct 2008 19:30:17 -0000 1.4.6.1 *************** *** 1,11 **** /* ! * Copyright 2002-2005 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, --- 1,11 ---- /* ! * Copyright 2002-2008 the original author or authors. ! * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at ! * * http://www.apache.org/licenses/LICENSE-2.0 ! * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, *************** *** 21,31 **** /** ! * JavaBean for holding Custom JDBC Error Codes translation for a particular ! * database. The exceptionClass property defines which exception will be * thrown for the list of error codes specified in the errorCodes property. * - * <p>Normally loaded through a BeanFactory implementation. - * Used by the SQLErrorCodeSQLExceptionTranslator. - * * @author Thomas Risberg * @since 1.1 --- 21,28 ---- /** ! * JavaBean for holding custom JDBC error codes translation for a particular ! * database. The "exceptionClass" property defines which exception will be * thrown for the list of error codes specified in the errorCodes property. * * @author Thomas Risberg * @since 1.1 *************** *** 37,41 **** private Class exceptionClass; ! /** * Set the SQL error codes to match. --- 34,39 ---- private Class exceptionClass; ! ! /** * Set the SQL error codes to match. *************** *** 49,53 **** */ public String[] getErrorCodes() { ! return errorCodes; } --- 47,51 ---- */ public String[] getErrorCodes() { ! return this.errorCodes; } *************** *** 67,71 **** */ public Class getExceptionClass() { ! return exceptionClass; } --- 65,69 ---- */ public Class getExceptionClass() { ! return this.exceptionClass; } Index: SQLErrorCodeSQLExceptionTranslator.java =================================================================== RCS file: /cvsroot/springframework/spring/src/org/springframework/jdbc/support/SQLErrorCodeSQLExceptionTranslator.java,v retrieving revision 1.27.2.1 retrieving revision 1.27.2.2 diff -C2 -d -r1.27.2.1 -r1.27.2.2 *** SQLErrorCodeSQLExceptionTranslator.java 31 May 2007 14:32:58 -0000 1.27.2.1 --- SQLErrorCodeSQLExceptionTranslator.java 16 Oct 2008 19:30:17 -0000 1.27.2.2 *************** *** 1,4 **** /* ! * Copyright 2002-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); --- 1,4 ---- /* ! * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); *************** *** 35,38 **** --- 35,39 ---- import org.springframework.jdbc.BadSqlGrammarException; import org.springframework.jdbc.InvalidResultSetAccessException; + import org.springframework.jdbc.UncategorizedSQLException; /** *************** *** 160,170 **** */ public SQLErrorCodes getSqlErrorCodes() { ! return sqlErrorCodes; } /** * Override the default SQL state fallback translator. - * @param fallback custom fallback exception translator to use if error code - * translation fails * @see SQLStateSQLExceptionTranslator */ --- 161,169 ---- */ public SQLErrorCodes getSqlErrorCodes() { ! return this.sqlErrorCodes; } /** * Override the default SQL state fallback translator. * @see SQLStateSQLExceptionTranslator */ *************** *** 177,181 **** */ public SQLExceptionTranslator getFallbackTranslator() { ! return fallbackTranslator; } --- 176,180 ---- */ public SQLExceptionTranslator getFallbackTranslator() { ! return this.fallbackTranslator; } *************** *** 274,278 **** ", will now try the fallback translator"); } ! return this.fallbackTranslator.translate(task, sql, sqlEx); } --- 273,283 ---- ", will now try the fallback translator"); } ! ! if (this.fallbackTranslator != null) { ! return this.fallbackTranslator.translate(task, sql, sqlEx); ! } ! else { ! return new UncategorizedSQLException(task, sql, sqlEx); ! } } |