openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r931562 - in /openjpa/branches/2.0.x: openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
Date Wed, 07 Apr 2010 14:14:49 GMT
Author: dwoods
Date: Wed Apr  7 14:14:48 2010
New Revision: 931562

URL: http://svn.apache.org/viewvc?rev=931562&view=rev
Log:
OPENJPA-1614 Testcase failures in TextException on MSSQL due to missing <object-exists>
value in sql-error-state-codes.xml

Modified:
    openjpa/branches/2.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml
    openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java

Modified: openjpa/branches/2.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml?rev=931562&r1=931561&r2=931562&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml
(original)
+++ openjpa/branches/2.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/sql/sql-error-state-codes.xml
Wed Apr  7 14:14:48 2010
@@ -49,7 +49,7 @@
 	<dictionary class="org.apache.openjpa.jdbc.sql.SQLServerDictionary">
 		<lock>1204,1205,1222</lock>
 		<referential-integrity>544,2601,2627,8114,8115</referential-integrity>
-		<object-exists></object-exists>
+		<object-exists>23000</object-exists>
 		<object-not-found></object-not-found>
 		<optimistic>1205</optimistic>
 		<query>HY008</query>

Modified: openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java?rev=931562&r1=931561&r2=931562&view=diff
==============================================================================
--- openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
(original)
+++ openjpa/branches/2.0.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/exception/TestException.java
Wed Apr  7 14:14:48 2010
@@ -202,9 +202,15 @@ public class TestException extends Singl
 	 */
 	public void assertException(Throwable t, Class expectedType) {
 		if (!isExpectedException(t, expectedType)) {
-			t.printStackTrace();
+		    getLog().error("TestException.assertException() - unexpected exception type", t);
+			//t.printStackTrace();
 			print(t, 0);
             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 Singl
 	
 	void print(Throwable t, int tab) {
 		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) ? 
 			"(SQLState=" + ((SQLException)t).getSQLState() + ":" 
 				+ t.getMessage() + ")" : "";
-		System.out.println(t.getClass().getName() + sqlState);
+		str.append(t.getClass().getName() + sqlState);
+		getLog().error(str);
 		if (t.getCause() == t) 
 			return;
 		print(t.getCause(), tab+1);



Mime
View raw message