1. #1
    Ext User
    Join Date
    Dec 2007
    Posts
    1
    Vote Rating
    0
    brom38 is on a distinguished road

      0  

    Default [FIXED] Store commit/reject changes bug

    [FIXED] Store commit/reject changes bug


    When I try commit or reject changes for "dirty" Store I recieve java.util.ConcurrentModificationException.

    Code:
    com.extjs.gxt.ui.client.store.Store.java
    ...
      public void rejectChanges() {
        for (Record r : modified) {    // iterate through "modified" list
          r.reject(false);                 // in this method fire: store.afterReject(this);
        }
        modified.clear();
      }
    ...
      protected void afterReject(Record record) {
        modified.remove(record);    // change "modified" list !!!!
      // in next iteration through "modified" list in rejectChanges() I recieve ConcurrentModificationException
        fireStoreEvent(Update, RecordUpdate.REJECT, record);
      }

  2. #2
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    Fix is in SVN.

  3. #3
    Ext User
    Join Date
    Apr 2008
    Posts
    14
    Vote Rating
    0
    tikvar is on a distinguished road

      0  

    Default [2.0.1] ConcurrentModiificationException in Record.reject()

    [2.0.1] ConcurrentModiificationException in Record.reject()


    I came across the same issue in Record:

    Code:
    com.extjs.gxt.ui.client.store.Record.java
    ...
      public void reject(boolean silent) {
        if (modified != null) {
          for (String p : modified.keySet()) {
            model.set(p, modified.get(p));
            // the call above this line leads (via FieldBinding) to a call to Record.set(p, modified.get(p))
            // which changes the modified field and this results in ConcurrentModiificationException 
          }
        }
        ...
      }
    
      public void set(String name, Object value) {
        ...
        if (!modified.containsKey(name)) {
          modified.put(name, model.get(name));
        } else {
          Object origValue = modified.get(name);
          if ((origValue == null && value == null)
              || (origValue != null && origValue.equals(value))) {
    
            modified.remove(name);
            ...
          }
    
        }
        ...
      }
    To fix the issue, just make a copy of the keyset before iterating over it:
    Code:
    com.extjs.gxt.ui.client.store.Record.java
    ...
      public void reject(boolean silent) {
        if (modified != null) {
          List<String> modifiedKeys = new ArrayList<String>(modified.keySet());
          for (String p : modifiedKeys) {
            model.set(p, modified.get(p));
          }
        }
        ...
      }

  4. #4
    Sencha - GXT Dev Team darrellmeyer's Avatar
    Join Date
    May 2007
    Location
    Washington, DC
    Posts
    2,241
    Vote Rating
    2
    darrellmeyer is on a distinguished road

      0  

    Default


    Fixed in trunk. Change will be available in 2.1 release.

Thread Participants: 2

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar