db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1075842 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java
Date Tue, 01 Mar 2011 15:08:30 GMT
Author: kahatlen
Date: Tue Mar  1 15:08:29 2011
New Revision: 1075842

URL: http://svn.apache.org/viewvc?rev=1075842&view=rev
Log:
DERBY-5076: Remove some unnecessary casts in ExceptionFormatter

Based on patch contributed by Dave Brosius <dbrosius@apache.org>.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java?rev=1075842&r1=1075841&r2=1075842&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/ExceptionFormatter.java Tue
Mar  1 15:08:29 2011
@@ -40,19 +40,19 @@ public class ExceptionFormatter {
                 if (throwable != null) {
                     printTrace(throwable, printWriter, header);
                 }
-                Sqlca sqlca = ((Diagnosable) e).getSqlca();
+                Sqlca sqlca = e.getSqlca();
                 if (sqlca != null) {
                     printTrace(sqlca, printWriter, header);
                     // JDK stack trace calls e.getMessage(), so we must set some state on
the sqlca that says return tokens only.
-                    ((Sqlca) sqlca).returnTokensOnlyInMessageText(returnTokensOnly);
+                    sqlca.returnTokensOnlyInMessageText(returnTokensOnly);
                 }
 
                 printWriter.println(header + " SQL state  = " + e.getSQLState());
                 printWriter.println(header + " Error code = " + String.valueOf(e.getErrorCode()));
-                if (((Diagnosable) e).getSqlca() == null) { // Too much has changed, so escape
out here.
+                if (e.getSqlca() == null) { // Too much has changed, so escape out here.
                     printWriter.println(header + " Message    = " + e.getMessage());
                 } else { // This is server-side error.
-                    sqlca = ((Diagnosable) e).getSqlca();
+                    sqlca = e.getSqlca();
                     if (returnTokensOnly) {
                         // print message tokens directly.
                         printWriter.println(header + " Tokens     = " + sqlca.getSqlErrmc());
// a string containing error tokens only
@@ -81,13 +81,11 @@ public class ExceptionFormatter {
                 printWriter.println(header + " Stack trace follows");
                 e.printStackTrace(printWriter);
 
-                if (e instanceof Diagnosable) {
-                    sqlca = (Sqlca) ((Diagnosable) e).getSqlca();
-                    if (sqlca != null) {
-                        // JDK stack trace calls e.getMessage(), now that it is finished,
-                        // we can reset the state on the sqlca that says return tokens only.
-                        sqlca.returnTokensOnlyInMessageText(false);
-                    }
+                sqlca = e.getSqlca();
+                if (sqlca != null) {
+                    // JDK stack trace calls e.getMessage(), now that it is finished,
+                    // we can reset the state on the sqlca that says return tokens only.
+                    sqlca.returnTokensOnlyInMessageText(false);
                 }
 
                 e = e.getNextException();



Mime
View raw message