mirror of https://github.com/apache/openjpa.git
OPENJPA-1614 Testcase failures in TextException on MSSQL due to missing <object-exists> value in sql-error-state-codes.xml
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@931535 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
50202d956b
commit
b2b922e1c8
|
@ -49,7 +49,7 @@
|
||||||
<dictionary class="org.apache.openjpa.jdbc.sql.SQLServerDictionary">
|
<dictionary class="org.apache.openjpa.jdbc.sql.SQLServerDictionary">
|
||||||
<lock>1204,1205,1222</lock>
|
<lock>1204,1205,1222</lock>
|
||||||
<referential-integrity>544,2601,2627,8114,8115</referential-integrity>
|
<referential-integrity>544,2601,2627,8114,8115</referential-integrity>
|
||||||
<object-exists></object-exists>
|
<object-exists>23000</object-exists>
|
||||||
<object-not-found></object-not-found>
|
<object-not-found></object-not-found>
|
||||||
<optimistic>1205</optimistic>
|
<optimistic>1205</optimistic>
|
||||||
<query>HY008</query>
|
<query>HY008</query>
|
||||||
|
|
|
@ -202,9 +202,15 @@ public class TestException extends SingleEMFTestCase {
|
||||||
*/
|
*/
|
||||||
public void assertException(Throwable t, Class expectedType) {
|
public void assertException(Throwable t, Class expectedType) {
|
||||||
if (!isExpectedException(t, expectedType)) {
|
if (!isExpectedException(t, expectedType)) {
|
||||||
t.printStackTrace();
|
getLog().error("TestException.assertException() - unexpected exception type", t);
|
||||||
|
//t.printStackTrace();
|
||||||
print(t, 0);
|
print(t, 0);
|
||||||
fail(t + " or its cause is not instanceof " + expectedType);
|
fail(t + " or its cause is not instanceof " + expectedType);
|
||||||
|
} else {
|
||||||
|
if (getLog().isTraceEnabled()) {
|
||||||
|
getLog().trace("TestException.assertException() - caught expected exception type=" +
|
||||||
|
expectedType, t);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,11 +228,14 @@ public class TestException extends SingleEMFTestCase {
|
||||||
|
|
||||||
void print(Throwable t, int tab) {
|
void print(Throwable t, int tab) {
|
||||||
if (t == null) return;
|
if (t == null) return;
|
||||||
for (int i=0; i<tab*4;i++) System.out.print(" ");
|
StringBuilder str = new StringBuilder(80);
|
||||||
|
for (int i=0; i<tab*4;i++)
|
||||||
|
str.append(" ");
|
||||||
String sqlState = (t instanceof SQLException) ?
|
String sqlState = (t instanceof SQLException) ?
|
||||||
"(SQLState=" + ((SQLException)t).getSQLState() + ":"
|
"(SQLState=" + ((SQLException)t).getSQLState() + ":"
|
||||||
+ t.getMessage() + ")" : "";
|
+ t.getMessage() + ")" : "";
|
||||||
System.out.println(t.getClass().getName() + sqlState);
|
str.append(t.getClass().getName() + sqlState);
|
||||||
|
getLog().error(str);
|
||||||
if (t.getCause() == t)
|
if (t.getCause() == t)
|
||||||
return;
|
return;
|
||||||
print(t.getCause(), tab+1);
|
print(t.getCause(), tab+1);
|
||||||
|
|
Loading…
Reference in New Issue