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 Identity.java
Date Tue, 15 Feb 2005 15:34:18 GMT
arminw      2005/02/15 07:34:18

  Modified:    src/java/org/apache/ojb/broker Tag: OJB_1_0_RELEASE
                        Identity.java
  Log:
  add more detailed log msg
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.36.2.4  +22 -8     db-ojb/src/java/org/apache/ojb/broker/Identity.java
  
  Index: Identity.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/Identity.java,v
  retrieving revision 1.36.2.3
  retrieving revision 1.36.2.4
  diff -u -r1.36.2.3 -r1.36.2.4
  --- Identity.java	20 Sep 2004 13:41:46 -0000	1.36.2.3
  +++ Identity.java	15 Feb 2005 15:34:18 -0000	1.36.2.4
  @@ -22,6 +22,8 @@
   import org.apache.ojb.broker.core.proxy.ProxyHelper;
   import org.apache.ojb.broker.util.BrokerHelper;
   import org.apache.commons.lang.builder.HashCodeBuilder;
  +import org.apache.commons.lang.SystemUtils;
  +import org.apache.commons.lang.ArrayUtils;
   
   import java.io.ByteArrayInputStream;
   import java.io.ByteArrayOutputStream;
  @@ -154,8 +156,19 @@
           }
           catch (Exception e)
           {
  -            throw new ClassNotPersistenceCapableException("Can not init Identity for given
object " +
  -                    objectToIdentify, e);
  +            if(e instanceof ClassNotPersistenceCapableException)
  +            {
  +                throw (ClassNotPersistenceCapableException) e;
  +            }
  +            else
  +            {
  +                String eol = SystemUtils.LINE_SEPARATOR;
  +                throw new ClassNotPersistenceCapableException("Can not init Identity for
given object." + eol +
  +                    "objectTopLevelClass=" + (m_objectsTopLevelClass != null ? m_objectsTopLevelClass.getName()
: null) + eol +
  +                    "objectRealClass=" + (m_objectsRealClass != null ? m_objectsRealClass.getName()
: null) + eol +
  +                    "pkValues=" + (m_pkValues != null ? ArrayUtils.toString(m_pkValues)
: null) + eol +
  +                    "object to identify: " + objectToIdentify, e);
  +            }
           }
       }
   
  @@ -272,12 +285,13 @@
       protected void checkForPrimaryKeys() throws ClassNotPersistenceCapableException
       {
           // if no PKs are specified OJB can't handle this class !
  -        if (m_pkValues.length == 0)
  +        if (m_pkValues == null || m_pkValues.length == 0)
           {
  -            throw new ClassNotPersistenceCapableException(
  -                    "OJB needs at least one primary key attribute for class "
  -                    + " objectsRealClass=" + m_objectsRealClass
  -                    + ", objectTopLevelClass=" + m_objectsTopLevelClass);
  +            String eol = SystemUtils.LINE_SEPARATOR;
  +            throw new ClassNotPersistenceCapableException("OJB needs at least one primary
key attribute for class: " + eol +
  +                    "objectTopLevelClass=" + (m_objectsTopLevelClass != null ? m_objectsTopLevelClass.getName()
: null) + eol +
  +                    "objectRealClass=" + (m_objectsRealClass != null ? m_objectsRealClass.getName()
: null) + eol +
  +                    "pkValues=" + (m_pkValues != null ? ArrayUtils.toString(m_pkValues)
: null) + eol);
   
           }
           if(m_pkValues[0] instanceof ValueContainer)
  
  
  

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