db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1052268 - in /db/derby/code/trunk/java: client/org/apache/derby/client/net/NetResultSet40.java engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java
Date Thu, 23 Dec 2010 13:50:45 GMT
Author: rhillegas
Date: Thu Dec 23 13:50:45 2010
New Revision: 1052268

URL: http://svn.apache.org/viewvc?rev=1052268&view=rev
Log:
DERBY-4869: Simplify casting logic in getObject(int,Class).

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java?rev=1052268&r1=1052267&r2=1052268&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/net/NetResultSet40.java Thu Dec
23 13:50:45 2010
@@ -298,9 +298,7 @@ public class NetResultSet40 extends NetR
             else if ( type.isArray() && type.getComponentType().equals( byte.class
) ) { return (T) getBytes( columnIndex ); }
             else
             {
-                Object  result = getObject( columnIndex );
-                if ( !type.isInstance( result ) ) { throw new ClassCastException( type.getName()
); }
-                return (T) result;
+                return type.cast( getObject( columnIndex ) );
             }
         }
         catch (Exception e) { ex = e; }

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java?rev=1052268&r1=1052267&r2=1052268&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedResultSet40.java Thu Dec
23 13:50:45 2010
@@ -279,9 +279,7 @@ public class EmbedResultSet40 extends or
             else if ( type.isArray() && type.getComponentType().equals( byte.class
) ) { return (T) getBytes( columnIndex ); }
             else
             {
-                Object  result = getObject( columnIndex );
-                if ( !type.isInstance( result ) ) { throw new ClassCastException( type.getName()
); }
-                return (T) result;
+                return type.cast( getObject( columnIndex ) );
             }
         }
         catch (ClassCastException e) {}



Mime
View raw message