db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions Boolean2IntFieldConversion.java
Date Mon, 08 Dec 2003 10:18:17 GMT
arminw      2003/12/08 02:18:16

  Modified:    src/java/org/apache/ojb/broker/util SqlTypeHelper.java
               src/java/org/apache/ojb/broker/platforms
                        PlatformOracle9iImpl.java ClobWrapper.java
               src/java/org/apache/ojb/broker/accesslayer/conversions
                        Boolean2IntFieldConversion.java
  Log:
  fix compatibility bug
  
  Boolean.valueOf is >= JDK 1.4.x only
  
  Revision  Changes    Path
  1.7       +6 -5      db-ojb/src/java/org/apache/ojb/broker/util/SqlTypeHelper.java
  
  Index: SqlTypeHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/SqlTypeHelper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- SqlTypeHelper.java	6 Dec 2003 15:54:56 -0000	1.6
  +++ SqlTypeHelper.java	8 Dec 2003 10:18:16 -0000	1.7
  @@ -56,6 +56,7 @@
   
   import org.apache.ojb.broker.util.sequence.SequenceManagerException;
   import org.apache.ojb.broker.OJBRuntimeException;
  +import org.apache.commons.lang.BooleanUtils;
   
   import java.sql.Ref;
   import java.sql.Types;
  @@ -391,14 +392,14 @@
                       {
                           boolean boolVal = columnId == MIN_INT
                                   ? stmt.getBoolean(columnName) : stmt.getBoolean(columnId);
  -                        result = (stmt.wasNull() ? null : Boolean.valueOf(boolVal));
  +                        result = (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(boolVal));
   
                       }
                       else
                       {
                           boolean boolVal = columnId == MIN_INT
                                   ? rs.getBoolean(columnName) : rs.getBoolean(columnId);
  -                        result = (rs.wasNull() ? null : Boolean.valueOf(boolVal));
  +                        result = (rs.wasNull() ? null : BooleanUtils.toBooleanObject(boolVal));
                       }
                       break;
                   }
  @@ -709,13 +710,13 @@
                       {
                           boolean boolVal = columnId == MIN_INT
                                   ? stmt.getBoolean(columnName) : stmt.getBoolean(columnId);
  -                        result = (stmt.wasNull() ? null : Boolean.valueOf(boolVal));
  +                        result = (stmt.wasNull() ? null : BooleanUtils.toBooleanObject(boolVal));
                       }
                       else
                       {
                           boolean boolVal = columnId == MIN_INT
                                   ? rs.getBoolean(columnName) : rs.getBoolean(columnId);
  -                        result = (rs.wasNull() ? null : Boolean.valueOf(boolVal));
  +                        result = (rs.wasNull() ? null : BooleanUtils.toBooleanObject(boolVal));
                       }
                       break;
                   }
  
  
  
  1.8       +10 -8     db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracle9iImpl.java
  
  Index: PlatformOracle9iImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/PlatformOracle9iImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PlatformOracle9iImpl.java	6 Dec 2003 12:29:13 -0000	1.7
  +++ PlatformOracle9iImpl.java	8 Dec 2003 10:18:16 -0000	1.8
  @@ -54,14 +54,17 @@
    * <http://www.apache.org/>.
    */
   
  -import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
  -import org.apache.ojb.broker.util.logging.Logger;
  -import org.apache.ojb.broker.util.logging.LoggerFactory;
  -
  +import java.io.ByteArrayInputStream;
   import java.lang.reflect.InvocationTargetException;
   import java.lang.reflect.Method;
  -import java.sql.*;
  -import java.io.ByteArrayInputStream;
  +import java.sql.Connection;
  +import java.sql.PreparedStatement;
  +import java.sql.ResultSet;
  +import java.sql.SQLException;
  +import java.sql.Statement;
  +import java.sql.Types;
  +
  +import org.apache.ojb.broker.metadata.JdbcConnectionDescriptor;
   
   /**
    *  This class is a concrete implementation of <code>Platform</code>. Provides
  @@ -86,7 +89,6 @@
   
   public class PlatformOracle9iImpl extends PlatformOracleImpl
   {
  -	private Logger logger = LoggerFactory.getLogger(PlatformOracle9iImpl.class);
   	private static final Object[] BATCH_SIZE = {new Integer(10)};
   	private static final Class[] PARAM_TYPE_INTEGER = {Integer.TYPE};
   	private static final Class[] PARAM_TYPE_BOOLEAN = {Boolean.TYPE};
  @@ -154,7 +156,7 @@
   			try
   			{
   				SET_STATEMENT_CACHING_ENABLE.invoke(conn, new Object[]{new Integer(STATEMENT_CACHE_SIZE)});
// use a 100 item cache
  -				SET_IMPLICIT_CACHING_ENABLED.invoke(conn, new Object[]{Boolean.valueOf( true )}); //
use implicit caching
  +				SET_IMPLICIT_CACHING_ENABLED.invoke(conn, new Object[]{Boolean.TRUE}); // use implicit
caching
   			}
   			catch (IllegalAccessException e)
   			{
  
  
  
  1.4       +2 -1      db-ojb/src/java/org/apache/ojb/broker/platforms/ClobWrapper.java
  
  Index: ClobWrapper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/platforms/ClobWrapper.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClobWrapper.java	6 Dec 2003 21:46:18 -0000	1.3
  +++ ClobWrapper.java	8 Dec 2003 10:18:16 -0000	1.4
  @@ -61,6 +61,7 @@
   import java.sql.Connection;
   import java.sql.SQLException;
   
  +import org.apache.commons.lang.BooleanUtils;
   import org.apache.ojb.broker.util.logging.LoggerFactory;
   
   /**
  @@ -143,7 +144,7 @@
   			/**
   			 * passing null to the invoke means this is a static method.
   			 */
  -			retval.m_clob = createTemporary.invoke(null, new Object[]{conn, Boolean.valueOf( b ),
new Integer(i)});
  +			retval.m_clob = createTemporary.invoke(null, new Object[]{conn, BooleanUtils.toBooleanObject(b),
new Integer(i)});
   		}
   		catch (IllegalAccessException e)
   		{
  
  
  
  1.5       +4 -7      db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/Boolean2IntFieldConversion.java
  
  Index: Boolean2IntFieldConversion.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/Boolean2IntFieldConversion.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Boolean2IntFieldConversion.java	6 Dec 2003 12:24:02 -0000	1.4
  +++ Boolean2IntFieldConversion.java	8 Dec 2003 10:18:16 -0000	1.5
  @@ -65,9 +65,6 @@
       private static Integer I_TRUE = new Integer(1);
       private static Integer I_FALSE = new Integer(0);
   
  -    private static Boolean B_TRUE = Boolean.valueOf(true);
  -    private static Boolean B_FALSE = Boolean.valueOf(false);
  -
       /*
        * @see FieldConversion#javaToSql(Object)
        */
  @@ -75,7 +72,7 @@
       {
           if (source instanceof Boolean)
           {
  -            if (source.equals(B_TRUE))
  +            if (source.equals(Boolean.TRUE))
               {
                   return I_TRUE;
               }
  @@ -99,11 +96,11 @@
           {
               if (source.equals(I_TRUE))
               {
  -                return B_TRUE;
  +                return Boolean.TRUE;
               }
               else
               {
  -                return B_FALSE;
  +                return Boolean.FALSE;
               }
           }
           else
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message