1. #1

    Default [FIXED] [1.2.3] TimeField has infinite loop

    [FIXED] [1.2.3] TimeField has infinite loop


    gxt 1.2.3
    JDK 1.6
    IDEA 8.01
    WindowsXP

    I could reproduce the infinite loop in com.extjs.gxt.ui.client.widget.form.TimeField#initList() method yesterday. And can't reproduce it now. Do you have any idea what could be wrong? GXT doesn't like March 29?

    Sample code that eats 100% of CPU:
    Code:
    import com.extjs.gxt.ui.client.widget.form.TimeField;
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.user.client.ui.RootPanel;
    
    public class TimeFieldSample implements EntryPoint {
        public void onModuleLoad() {
            RootPanel.get().add(new TimeField());
        }
    }
    I was debugging com.extjs.gxt.ui.client.widget.form.TimeField#initList
    Code:
      @Override
      protected void initList() {
        initialized = true;
        DateWrapper min = minValue != null ? new DateWrapper(minValue) : new DateWrapper();
        if (minValue == null) {
          min = min.clearTime();
        }
    
        DateWrapper max = maxValue != null ? new DateWrapper(maxValue) : new DateWrapper();
        if (maxValue == null) {
          max = max.clearTime().addMinutes((24 * 60) - 1);
        }
    
        List times = new ArrayList();
        while (min.before(max)) {
          Time r = new Time(min.asDate());
          r.set("text", getFormat().format(min.asDate()));
          times.add(r);
          min = min.addMinutes(increment);
        }
    
        ListStore store = new ListStore();
        store.add(times);
    
        setStore(store);
        setDisplayField("text");
        super.initList();
      }
    and found that min = min.addMinutes(increment); was looping around 2AM: 2:00AM -> 2:15AM -> 2:30AM -> 2:45AM -> 2:00AM
    So the code can't exit from the 'while' loop.

    That bug broke our application on March 29'th so I was looking for any workaround. And the following code worked fine:
    Code:
      @Override
      protected void initList() {
        initialized = true;
        DateWrapper min = minValue != null ? new DateWrapper(minValue) : new DateWrapper();
        if (minValue == null) {
          min = min.clearTime();
        }
    
        DateWrapper max = maxValue != null ? new DateWrapper(maxValue) : new DateWrapper();
        if (maxValue == null) {
          max = max.clearTime().addMinutes((24 * 60) - 1);
        }
    
        List times = new ArrayList();
        int count = 0;
        while (min.before(max)) {
          Time r = new Time(min.asDate());
          r.set("text", getFormat().format(min.asDate()));
          times.add(r);
          min = min.clearTime().addMinutes(count*increment);
          count++;
        }
    
        ListStore store = new ListStore();
        store.add(times);
    
        setStore(store);
        setDisplayField("text");
        super.initList();
      }
    Any ideas?

    I live in Ukraine. And yesterday we switched to the Summer time. Probably these 2 days when we switch to Summer/Winter time are not good days for GXT...

    As I know we switch to Summer time at 2:00AM!

  2. #2
    Sencha User
    Join Date
    Nov 2008
    Posts
    38
    Vote Rating
    0
    kht is on a distinguished road

      0  

    Default


    os: mac osx 10.5
    gxt: 1.2.3
    locale: de_AT

    i had the same problem here in austria. maybe it really depends on the swiching to summer time. endless initialization... yesterday (sunday) whole evening.
    this morning all started to work again without any problems.

    regards, kht

  3. #3
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Yes it depends on switching to summertime. I have a fix for this ready. So next time it should not happen again

  4. #4
    Software Architect
    Join Date
    Sep 2007
    Posts
    13,971
    Vote Rating
    132
    sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light sven is a glorious beacon of light

      0  

    Default


    Fixed in SVN.

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..."