commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ozeigerm...@apache.org
Subject cvs commit: jakarta-commons-sandbox/transaction/src/java/org/apache/commons/transaction/memory TransactionalMapWrapper.java
Date Fri, 04 Jun 2004 11:19:39 GMT
ozeigermann    2004/06/04 04:19:39

  Modified:    transaction/src/java/org/apache/commons/transaction/memory
                        TransactionalMapWrapper.java
  Log:
  Fixed size and keySet bug
  
  Revision  Changes    Path
  1.13      +13 -10    jakarta-commons-sandbox/transaction/src/java/org/apache/commons/transaction/memory/TransactionalMapWrapper.java
  
  Index: TransactionalMapWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/transaction/src/java/org/apache/commons/transaction/memory/TransactionalMapWrapper.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- TransactionalMapWrapper.java	3 Jun 2004 14:15:31 -0000	1.12
  +++ TransactionalMapWrapper.java	4 Jun 2004 11:19:39 -0000	1.13
  @@ -218,7 +218,7 @@
           if (txContext == null) {
               return wrapped.isEmpty();
           } else {
  -            return (size() > 0);
  +            return (size() == 0);
           }
       }
   
  @@ -403,11 +403,12 @@
           }
   
           protected Set keys() {
  -            Set keySet = (cleared ? new HashSet() : wrapped.keySet());
  -            keySet.removeAll(deletes);
  +			Set keySet = new HashSet();
  +			if (!cleared) {
  +				keySet.addAll(wrapped.keySet());
  +			}
               keySet.addAll(adds.keySet());
               return keySet;
  -
           }
   
           protected Object get(Object key) {
  @@ -457,9 +458,11 @@
   
               try {
                   readOnly = false;
  +				changes.remove(key);
                   adds.remove(key);
  -                changes.remove(key);
  -                deletes.add(key);
  +                if (wrapped.containsKey(key)) {
  +					deletes.add(key);
  +                }
               } catch (RuntimeException e) {
                   rollbackOnly = true;
                   throw e;
  
  
  

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


Mime
View raw message