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 Calendar2DateFieldConversion.java Calendar2TimestampFieldConversion.java IntList2VarcharFieldConversion.java StringList2VarcharFieldConversion.java TimeList2VarcharFieldConversion.java
Date Sun, 20 Jun 2004 12:34:49 GMT
arminw      2004/06/20 05:34:49

  Modified:    src/java/org/apache/ojb/broker/accesslayer/conversions
                        Calendar2DateFieldConversion.java
                        Calendar2TimestampFieldConversion.java
                        IntList2VarcharFieldConversion.java
                        StringList2VarcharFieldConversion.java
                        TimeList2VarcharFieldConversion.java
  Log:
  fix JDK 1.3 compatibility problems
  
  Revision  Changes    Path
  1.2       +5 -3      db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/Calendar2DateFieldConversion.java
  
  Index: Calendar2DateFieldConversion.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/Calendar2DateFieldConversion.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Calendar2DateFieldConversion.java	11 Jun 2004 22:05:58 -0000	1.1
  +++ Calendar2DateFieldConversion.java	20 Jun 2004 12:34:49 -0000	1.2
  @@ -37,7 +37,9 @@
       {
           if (source instanceof Calendar)
           {
  -            return new Date(((Calendar) source).getTimeInMillis());
  +            // only valid >= JDK 1.4
  +            // return new Date(((Calendar) source).getTimeInMillis());
  +            return new Date(((Calendar) source).getTime().getTime());
           }
           else
           {
  @@ -53,7 +55,7 @@
           if (source instanceof Date)
           {
               GregorianCalendar cal = new GregorianCalendar();
  -            cal.setTimeInMillis(((Date) source).getTime());
  +            cal.setTime(((Date) source));
               return cal;
           }
           else
  
  
  
  1.2       +7 -3      db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/Calendar2TimestampFieldConversion.java
  
  Index: Calendar2TimestampFieldConversion.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/Calendar2TimestampFieldConversion.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Calendar2TimestampFieldConversion.java	11 Jun 2004 22:05:58 -0000	1.1
  +++ Calendar2TimestampFieldConversion.java	20 Jun 2004 12:34:49 -0000	1.2
  @@ -37,7 +37,9 @@
       {
           if (source instanceof Calendar)
           {
  -            return new Timestamp(((Calendar) source).getTimeInMillis());
  +            // only valid >= JDK 1.4
  +            // return new Date(((Calendar) source).getTimeInMillis());
  +            return new Timestamp(((Calendar) source).getTime().getTime());
           }
           else
           {
  @@ -53,7 +55,9 @@
           if (source instanceof Timestamp)
           {
               GregorianCalendar cal = new GregorianCalendar();
  -            cal.setTimeInMillis(((Timestamp) source).getTime());
  +            // only valid >= JDK 1.4
  +            // cal.setTimeInMillis(((Date) source).getTime());
  +            cal.setTime(((Timestamp) source));
               return cal;
           }
           else
  
  
  
  1.2       +6 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/IntList2VarcharFieldConversion.java
  
  Index: IntList2VarcharFieldConversion.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/IntList2VarcharFieldConversion.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IntList2VarcharFieldConversion.java	11 Jun 2004 22:05:58 -0000	1.1
  +++ IntList2VarcharFieldConversion.java	20 Jun 2004 12:34:49 -0000	1.2
  @@ -18,6 +18,8 @@
   import java.util.ArrayList;
   import java.util.List;
   
  +import org.apache.commons.lang.StringUtils;
  +
   /**
    * This implementation of the {@link FieldConversion} interface converts
    * between a {@link java.util.List} of {@link java.lang.Integer} objects and a database
  @@ -59,7 +61,9 @@
               {
                   Integer obj = (Integer) intList.get(i);
                   String newSt = obj.toString();
  -                newSt = newSt.replaceAll("#", "##");
  +                // introduced in JDK 1.4, replace with commons-lang
  +                // newSt = newSt.replaceAll("#", "##");
  +                newSt = StringUtils.replace(newSt, "#", "##");
                   result.append(newSt);
                   result.append("#");
               }
  
  
  
  1.2       +6 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/StringList2VarcharFieldConversion.java
  
  Index: StringList2VarcharFieldConversion.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/StringList2VarcharFieldConversion.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringList2VarcharFieldConversion.java	11 Jun 2004 22:05:58 -0000	1.1
  +++ StringList2VarcharFieldConversion.java	20 Jun 2004 12:34:49 -0000	1.2
  @@ -18,6 +18,8 @@
   import java.util.ArrayList;
   import java.util.List;
   
  +import org.apache.commons.lang.StringUtils;
  +
   /**
    * This implementation of the {@link FieldConversion} interface converts
    * between a {@link java.util.List} of {@link java.lang.String} objects and a database
  @@ -61,7 +63,9 @@
               for (int i = 0; i < stringList.size(); i++)
               {
                   String newSt = (String) stringList.get(i);
  -                newSt = newSt.replaceAll("#", "##");
  +                // introduced in JDK 1.4, replace with commons-lang
  +                // newSt = newSt.replaceAll("#", "##");
  +                newSt = StringUtils.replace(newSt, "#", "##");
                   if (i > 0)
                   {
                       result.append("#");
  
  
  
  1.2       +6 -2      db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/TimeList2VarcharFieldConversion.java
  
  Index: TimeList2VarcharFieldConversion.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/conversions/TimeList2VarcharFieldConversion.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TimeList2VarcharFieldConversion.java	11 Jun 2004 22:05:58 -0000	1.1
  +++ TimeList2VarcharFieldConversion.java	20 Jun 2004 12:34:49 -0000	1.2
  @@ -19,6 +19,8 @@
   import java.util.ArrayList;
   import java.util.List;
   
  +import org.apache.commons.lang.StringUtils;
  +
   /**
    * This implementation of the {@link FieldConversion} interface converts
    * between a {@link java.util.List} of {@link java.sql.Time} objects and a database
  @@ -60,7 +62,9 @@
               {
                   Time obj = (Time) timeList.get(i);
                   String newSt = obj.toString();
  -                newSt = newSt.replaceAll("#", "##");
  +                // introduced in JDK 1.4, replace with commons-lang
  +                // newSt = newSt.replaceAll("#", "##");
  +                newSt = StringUtils.replace(newSt, "#", "##");
                   result.append(newSt);
                   result.append("#");
               }
  
  
  

---------------------------------------------------------------------
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