db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1087346 - /db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java
Date Thu, 31 Mar 2011 15:41:55 GMT
Author: rhillegas
Date: Thu Mar 31 15:41:55 2011
New Revision: 1087346

URL: http://svn.apache.org/viewvc?rev=1087346&view=rev
Log:
DERBY-2515: Improve exception handling when copying INOUT args.

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

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java?rev=1087346&r1=1087345&r2=1087346&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/CallableStatement.java Thu
Mar 31 15:41:55 2011
@@ -1185,32 +1185,37 @@ public class CallableStatement extends P
         if ( parameterMetaData_ == null ) { return; }
 
         int     cursorParamCount = singletonParams.columns_;
-        try {
-            for ( int i = 0; i < cursorParamCount; i++ )
+        
+        for ( int i = 0; i < cursorParamCount; i++ )
+        {
+            if ( parameterMetaData_.sqlxParmmode_[ i ] == java.sql.ParameterMetaData.parameterModeInOut
)
             {
-                if ( parameterMetaData_.sqlxParmmode_[ i ] == java.sql.ParameterMetaData.parameterModeInOut
)
+                int jdbcParamNumber = i + 1;
+                Object  returnArg;
+                
+                try {
+                    returnArg = singletonParams.isNull_[ i ] ? null : singletonParams.getObject(
jdbcParamNumber );
+                } catch (SqlException se)
                 {
-                    int jdbcParamNumber = i + 1;
-                    Object  returnArg = singletonParams.isNull_[ i ] ? null : singletonParams.getObject(
jdbcParamNumber );
-
-                    //
-                    // special case to coerce Integer to Short for SMALLINT
-                    //
-                    if ( parameterMetaData_.types_[ i ] == Types.SMALLINT )
+                    IllegalArgumentException iae = new IllegalArgumentException( se.getMessage()
);
+                    iae.initCause( se );
+                    throw iae;
+                }
+                
+                //
+                // special case to coerce Integer to Short for SMALLINT
+                //
+                if ( parameterMetaData_.types_[ i ] == Types.SMALLINT )
+                {
+                    if ( (returnArg != null) && (returnArg instanceof Integer) )
                     {
-                        if ( (returnArg != null) && (returnArg instanceof Integer)
)
-                        {
-                            returnArg = new Short( ((Integer) returnArg).shortValue() );
-                        }
+                        returnArg = new Short( ((Integer) returnArg).shortValue() );
                     }
-                    
-                    setInput( jdbcParamNumber, returnArg );
                 }
-            }
-        } catch (Exception se)
-        {
-            throw new IllegalArgumentException( se.getMessage() );
-        }
+                
+                setInput( jdbcParamNumber, returnArg );
+            }   // end if INOUT arg
+        }       // end loop through args
     }
 
     



Mime
View raw message