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 RsIterator.java
Date Sun, 02 Mar 2003 17:32:05 GMT
arminw      2003/03/02 09:32:05

  Modified:    src/java/org/apache/ojb/broker/util BrokerHelper.java
               src/java/org/apache/ojb/broker/metadata FieldDescriptor.java
               src/java/org/apache/ojb/broker/accesslayer RsIterator.java
  Log:
  add more logging info
  
  Revision  Changes    Path
  1.11      +27 -19    db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java
  
  Index: BrokerHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/util/BrokerHelper.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- BrokerHelper.java	2 Mar 2003 09:11:58 -0000	1.10
  +++ BrokerHelper.java	2 Mar 2003 17:32:04 -0000	1.11
  @@ -54,10 +54,6 @@
    * <http://www.apache.org/>.
    */
   
  -import java.lang.reflect.Field;
  -import java.lang.reflect.Proxy;
  -import java.util.StringTokenizer;
  -
   import org.apache.commons.lang.SystemUtils;
   import org.apache.ojb.broker.Identity;
   import org.apache.ojb.broker.OJBRuntimeException;
  @@ -75,6 +71,10 @@
   import org.apache.ojb.broker.singlevm.PersistenceBrokerConfiguration;
   import org.apache.ojb.broker.util.sequence.SequenceManagerException;
   
  +import java.lang.reflect.Field;
  +import java.lang.reflect.Proxy;
  +import java.util.StringTokenizer;
  +
   
   /**
    *
  @@ -136,11 +136,11 @@
        */
       public static PBKey crossCheckPBKey(PBKey key)
       {
  -        if(key.getUser() == null)
  +        if (key.getUser() == null)
           {
               PBKey defKey = MetadataManager.getInstance().
  -                            connectionRepository().getStandardPBKeyForJcdAlias(key.getAlias());
  -            if(defKey != null)
  +                    connectionRepository().getStandardPBKeyForJcdAlias(key.getAlias());
  +            if (defKey != null)
               {
                   return defKey;
               }
  @@ -249,18 +249,26 @@
           FieldDescriptor[] pkFields = cld.getPkFields();
           Object[] result = new Object[pkFields.length];
           Object[] pkValues = oid.getPrimaryKeyValues();
  -              
  -        for (int i = 0; i < result.length; i++)
  -        {
  -            FieldDescriptor fmd = pkFields[i];
  -            Object cv = pkValues[i];
   
  -            if (convertToSql)
  +        try
  +        {
  +            for (int i = 0; i < result.length; i++)
               {
  -                // BRJ : apply type and value mapping
  -                cv = fmd.getFieldConversion().javaToSql(cv);
  +                FieldDescriptor fmd = pkFields[i];
  +                Object cv = pkValues[i];
  +
  +                if (convertToSql)
  +                {
  +                    // BRJ : apply type and value mapping
  +                    cv = fmd.getFieldConversion().javaToSql(cv);
  +                }
  +                result[i] = cv;
               }
  -            result[i] = cv;
  +        }
  +        catch (Exception e)
  +        {
  +            throw new PersistenceBrokerException("Could not generate primary key values
for given Identity " +
  +                    SystemUtils.LINE_SEPARATOR + oid + ", exception was " + e, e);
           }
           return result;
       }
  @@ -442,8 +450,8 @@
           }
           return result;
       }
  -    
  -    
  +
  +
       public static String buildMessageString(Object obj, Object value, Field field)
       {
           String eol = SystemUtils.LINE_SEPARATOR;
  
  
  
  1.16      +2 -1      db-ojb/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java
  
  Index: FieldDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/FieldDescriptor.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- FieldDescriptor.java	9 Jan 2003 16:58:36 -0000	1.15
  +++ FieldDescriptor.java	2 Mar 2003 17:32:04 -0000	1.16
  @@ -55,6 +55,7 @@
    */
   
   import org.apache.commons.lang.builder.ToStringBuilder;
  +import org.apache.commons.lang.builder.ToStringStyle;
   import org.apache.commons.lang.SystemUtils;
   import org.apache.ojb.broker.OJBRuntimeException;
   import org.apache.ojb.broker.accesslayer.conversions.FieldConversion;
  @@ -268,7 +269,7 @@
       public String toString()
       {
           // here we got value of all fields
  -        return ToStringBuilder.reflectionToString(this);
  +        return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE);
       }
   
       /**
  
  
  
  1.30      +4 -4      db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java
  
  Index: RsIterator.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- RsIterator.java	19 Feb 2003 22:10:17 -0000	1.29
  +++ RsIterator.java	2 Mar 2003 17:32:04 -0000	1.30
  @@ -241,13 +241,13 @@
                   return obj;
               }
               else
  -                throw new NoSuchElementException();
  +                throw new NoSuchElementException("inner hasNext was false");
           }
           catch (Exception ex)
           {
  -            ex.printStackTrace();
  +            // ex.printStackTrace();
               logger.error(ex);
  -            throw new NoSuchElementException();
  +            throw new NoSuchElementException("Could not obtain next object: "+ex.getMessage());
           }
       }
   
  
  
  

Mime
View raw message