OPENJPA-184: handle the case where dict is null in SQLExceptions by moving the logic into DB2Dictionary.newStoreException().

git-svn-id: https://svn.apache.org/repos/asf/incubator/openjpa/trunk@525583 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-04-04 19:17:11 +00:00
parent fa68b7dcad
commit 7bd43ff2e0
3 changed files with 11 additions and 10 deletions

View File

@ -24,6 +24,7 @@ import java.util.StringTokenizer;
import org.apache.openjpa.jdbc.kernel.JDBCFetchConfiguration;
import org.apache.openjpa.jdbc.schema.Sequence;
import org.apache.openjpa.lib.log.Log;
import org.apache.openjpa.util.OpenJPAException;
/**
* Dictionary for IBM DB2 database.
@ -443,10 +444,18 @@ public class DB2Dictionary
return buf;
}
/** Append exception information from SQLCA to the exsisting
public OpenJPAException newStoreException(String msg, SQLException[] causes,
Object failed) {
if (causes != null && causes.length > 0)
msg = appendExtendedExceptionMsg(msg, causes[0]);
return super.newStoreException(msg, causes, failed);
}
/**
* Append exception information from SQLCA to the exsisting
* exception meassage
*/
public String appendExtendedExceptionMsg(String msg, SQLException sqle){
private String appendExtendedExceptionMsg(String msg, SQLException sqle){
final String GETSQLCA ="getSqlca";
String exceptionMsg = new String();
try {

View File

@ -2471,13 +2471,6 @@ public class DBDictionary
buf.append(post);
}
/** Append any database specific exception message to
* the exsisting exception message
*/
public String appendExtendedExceptionMsg(String msg, SQLException sqle) {
return msg;
}
///////////
// DDL SQL
///////////

View File

@ -87,7 +87,6 @@ public class SQLExceptions {
Object failed, DBDictionary dict) {
if (msg == null)
msg = se.getClass().getName();
msg = dict.appendExtendedExceptionMsg(msg,se);
SQLException[] ses = getSQLExceptions(se);
if (dict == null)
return new StoreException(msg).setFailedObject(failed).