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/odmg ObjectEnvelope.java TransactionImpl.java
Date Mon, 22 Aug 2005 15:30:59 GMT
arminw      2005/08/22 08:30:59

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE RsIterator.java
               src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        QueryReferenceBroker.java
               src/java/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        ObjectEnvelope.java TransactionImpl.java
  Log:
  code cleanup
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.63.2.14 +12 -6     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.63.2.13
  retrieving revision 1.63.2.14
  diff -u -r1.63.2.13 -r1.63.2.14
  --- RsIterator.java	9 Aug 2005 20:03:22 -0000	1.63.2.13
  +++ RsIterator.java	22 Aug 2005 15:30:59 -0000	1.63.2.14
  @@ -442,7 +442,7 @@
           {
               // 1.read Identity
               Identity oid = getIdentityFromResultSet();
  -            Object result = null;
  +            Object result;
   
               // 2. check if Object is in cache. if so return cached version.
               result = getCache().lookup(oid);
  @@ -531,9 +531,7 @@
       /**
        * with a new batch of JDBC 3.0 drivers coming out we can't just check for
        * begins with 2, we need to check the actual version and see if it's
  -     * greater than or equal to 2
  -     *
  -     * @return
  +     * greater than or equal to 2.
        */
       private boolean supportsAdvancedJDBCCursorControl()
       {
  @@ -626,7 +624,7 @@
                * combos are a lot more efficient at just moving the cursor and
                * returning the row in a real (not -1) number.
                */
  -            int whereIAm = 1; // first
  +            int whereIAm; // first
               try
               {
                   if (getRsAndStmt().m_rs != null)
  @@ -878,6 +876,14 @@
                       " Do automatic cleanup");
               releaseDbResources();
           }
  +        try
  +        {
  +            super.finalize();
  +        }
  +        catch(Throwable throwable)
  +        {
  +            throwable.printStackTrace();
  +        }
       }
   
       public String toString()
  
  
  
  No                   revision
  No                   revision
  1.17.2.11 +4 -9      db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
  
  Index: QueryReferenceBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java,v
  retrieving revision 1.17.2.10
  retrieving revision 1.17.2.11
  diff -u -r1.17.2.10 -r1.17.2.11
  --- QueryReferenceBroker.java	10 Aug 2005 19:32:19 -0000	1.17.2.10
  +++ QueryReferenceBroker.java	22 Aug 2005 15:30:59 -0000	1.17.2.11
  @@ -279,7 +279,7 @@
           // see http://db.apache.org/ojb/docu/guides/basic-technique.html#Mapping+m%3An+associations
   
           Class fieldType = cds.getPersistentField().getType();
  -        Class collType  = null;
  +        Class collType;
   
           if (fieldType.isArray() || fieldType.isAssignableFrom(RemovalAwareCollection.class))
           {
  @@ -785,16 +785,11 @@
       /**
        * Answer the foreign key query to retrieve the collection
        * defined by CollectionDescriptor
  -     *
  -     * @param obj
  -     * @param cld
  -     * @param cds
  -     * @return
        */
       private Query getFKQuery(Object obj, ClassDescriptor cld, CollectionDescriptor cds)
       {
  -        Query fkQuery = null;
  -        QueryByCriteria fkQueryCrit = null;
  +        Query fkQuery;
  +        QueryByCriteria fkQueryCrit;
   
           if (cds.isMtoNRelation())
           {
  
  
  
  No                   revision
  No                   revision
  1.32.2.16 +20 -14    db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelope.java
  
  Index: ObjectEnvelope.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/ObjectEnvelope.java,v
  retrieving revision 1.32.2.15
  retrieving revision 1.32.2.16
  diff -u -r1.32.2.15 -r1.32.2.16
  --- ObjectEnvelope.java	4 Jun 2005 14:38:13 -0000	1.32.2.15
  +++ ObjectEnvelope.java	22 Aug 2005 15:30:59 -0000	1.32.2.16
  @@ -315,21 +315,26 @@
            * not be updated in ODMG.
            */
           Iterator iter = mif.getObjectReferenceDescriptors(true).iterator();
  -        ObjectReferenceDescriptor rds = null;
  +        ObjectReferenceDescriptor rds;
           while(iter.hasNext())
           {
  -            Object referenceObject = null;
  +            Object referenceObject;
               EqualsRefHelper erh;
               rds = (ObjectReferenceDescriptor) iter.next();
   
               /*
  -             * synchronize on myObj so the ODMG-layer can take a snapshot only of
  -             * fully cached (i.e. with all references + collections) objects
  +             synchronize on myObj so the ODMG-layer can take a snapshot only of
  +             fully cached (i.e. with all references + collections) objects
  +             arminw:
  +             The PB-api only return full materialized objects, thus it's not
  +             needed to sync.
                */
  -            synchronized(myObj)
  -            {
  -                referenceObject = rds.getPersistentField().get(myObj);
  -            }
  +//            synchronized(myObj)
  +//            {
  +//                referenceObject = rds.getPersistentField().get(myObj);
  +//            }
  +            referenceObject = rds.getPersistentField().get(myObj);
  +
               /**
                * MBAIRD
                * In the case of a proxy, we check if it has been materialized
  @@ -359,7 +364,8 @@
               if object was serialized and anonymous FK are used in the main object, the
FK
               values are null, we have to refresh (re-assign) this values before building
field images
               */
  -            if(handler == null && referenceObject != null && BrokerHelper.hasAnonymousKeyReference(rds.getClassDescriptor(),
rds))
  +            if(handler == null && referenceObject != null
  +                    && BrokerHelper.hasAnonymousKeyReference(rds.getClassDescriptor(),
rds))
               {
                   getBroker().serviceBrokerHelper().link(myObj, rds, false);
               }
  @@ -397,7 +403,7 @@
            * How do we handle proxied collections and collections of proxies
            */
           Iterator collections = mif.getCollectionDescriptors(true).iterator();
  -        CollectionDescriptor cds = null;
  +        CollectionDescriptor cds;
           while(collections.hasNext())
           {
               cds = (CollectionDescriptor) collections.next();
  @@ -448,7 +454,7 @@
       private void prepareInitialState(boolean isNewObject)
       {
           // determine appropriate modification state
  -        ModificationState initialState = null;
  +        ModificationState initialState;
           if(isNewObject)
           {
               // if object is not already persistent it must be marked as new
  @@ -483,7 +489,7 @@
       {
           ObjectEnvelope envelope = buffer.getByIdentity(id);
   
  -        return (envelope == null ? false : envelope.needsDelete());
  +        return (envelope != null && envelope.needsDelete());
       }
   
       /**
  @@ -992,7 +998,7 @@
            */
           public boolean equals(Object obj)
           {
  -            return (obj instanceof EqualsColHelper) ? true : false;
  +            return (obj instanceof EqualsColHelper);
           }
   
           void prepareForCompare()
  @@ -1106,7 +1112,7 @@
               }
               finally
               {
  -                if(capsule != null) capsule.destroy();
  +                capsule.destroy();
               }
           }
       }
  
  
  
  1.59.2.20 +5 -12     db-ojb/src/java/org/apache/ojb/odmg/TransactionImpl.java
  
  Index: TransactionImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/TransactionImpl.java,v
  retrieving revision 1.59.2.19
  retrieving revision 1.59.2.20
  diff -u -r1.59.2.19 -r1.59.2.20
  --- TransactionImpl.java	22 Jun 2005 17:29:36 -0000	1.59.2.19
  +++ TransactionImpl.java	22 Aug 2005 15:30:59 -0000	1.59.2.20
  @@ -314,7 +314,7 @@
        */
       void doSingleLock(ClassDescriptor cld, Object obj, Identity oid, int lockMode) throws
LockNotGrantedException
       {
  -        LockManager lm = lm = implementation.getLockManager();
  +        LockManager lm = implementation.getLockManager();
           if (cld.isAcceptLocks())
           {
               if (lockMode == Transaction.READ)
  @@ -624,7 +624,7 @@
       public boolean isDeleted(Identity id)
       {
           ObjectEnvelope envelope = objectEnvelopeTable.getByIdentity(id);
  -        return (envelope == null ? false : envelope.needsDelete());
  +        return (envelope != null && envelope.needsDelete());
       }
   
       /**
  @@ -772,14 +772,7 @@
           if (txStatus != Status.STATUS_ACTIVE && txStatus != Status.STATUS_PREPARED
&&
                   txStatus != Status.STATUS_MARKED_ROLLBACK)
           {
  -            if(txStatus == Status.STATUS_NO_TRANSACTION)
  -            {
  -                throw new TransactionNotInProgressException("The Transaction was not started,
tx " + this);
  -            }
  -            else
  -            {
  -                throw new IllegalStateException("Illegal state for abort call, state was
'" + TxUtil.getStatusString(txStatus) + "'");
  -            }
  +            throw new IllegalStateException("Illegal state for abort call, state was '"
+ TxUtil.getStatusString(txStatus) + "'");
           }
           if(log.isEnabledFor(Logger.INFO))
           {
  @@ -1399,7 +1392,7 @@
        */
       protected boolean cascadeDeleteFor(ObjectReferenceDescriptor ord)
       {
  -        boolean result = false;
  +        boolean result;
           Boolean runtimeSetting = (Boolean) runtimeCascadeDeleteMap.get(ord);
           if(runtimeSetting == null)
           {
  
  
  

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