wei-spring / codenameone

Automatically exported from code.google.com/p/codenameone
0 stars 0 forks source link

Crashing when populating a list using the new ios vm, working when setting ios.newVM=false #1278

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Not sure how you can reproduce it but it crashes somewhere at this line of code:

reports.addComponent(createGroup(key, map.get(key)));

which is in this routine (class attached):
public void init() {
         Log.p("reports init");         

         reports.removeAll();

         Map<String, List<ReportInfo>> map = new HashMap<String, List<ReportInfo>>();

         for (ReportInfo ri : model.getReportRuns()) {
            if (!map.containsKey(ri.getGroupName()))
               map.put(ri.getGroupName(), new LinkedList<ReportInfo>());

            map.get(ri.getGroupName()).add(ri);            
         }       

         for (String key : new TreeSet<String>(map.keySet())) {            
             reports.addComponent(createGroup(key, map.get(key)));         
         }      

      }

What is the expected output? What do you see instead?
Expected output attached. Crashing without any error using the new vm.

Original issue reported on code.google.com by alnguyen...@gmail.com on 13 Jan 2015 at 12:38

Attachments:

GoogleCodeExporter commented 9 years ago
We can't reproduce this.
You will need to extract a test case we can actually run in order to submit an 
issue.

Original comment by shai.almog on 13 Jan 2015 at 1:08

GoogleCodeExporter commented 9 years ago
I can confirm that using TreeSet will cause the crash. The app is working after 
I remove TreeSet.

Original comment by alnguyen...@gmail.com on 26 Jan 2015 at 10:19

GoogleCodeExporter commented 9 years ago
Issue 1247 has been merged into this issue.

Original comment by st...@weblite.ca on 27 Jan 2015 at 11:45

GoogleCodeExporter commented 9 years ago
Are you still getting this issue?
If so I will need a test case so I can reproduce it.

Original comment by shai.almog on 1 Feb 2015 at 7:03

GoogleCodeExporter commented 9 years ago
The issue occurs when TreeSet is used to have a sorted list.

for (String key : new TreeSet<String>(map.keySet())) {            
             reports.addComponent(createGroup(key, map.get(key)));         
         } 

Original comment by alnguyen...@gmail.com on 1 Feb 2015 at 8:28

GoogleCodeExporter commented 9 years ago
That is not a test case. 
A test case is an app I can actually run e.g. 
https://code.google.com/p/codenameone/issues/detail?id=1304 see the initial 
attachment of TWMain. I could run it and reproduce the issue which helped a 
great deal in tracking the problem.

Original comment by shai.almog on 2 Feb 2015 at 6:59

GoogleCodeExporter commented 9 years ago
Here it is.

Original comment by alnguyen...@gmail.com on 2 Feb 2015 at 10:05

GoogleCodeExporter commented 9 years ago
That is way too much code, finding a VM bug is difficult with such a big test 
case since VM bugs are inherently deep inside. Please try to remove all 
redundant code, we could do this ourselves but its much harder for us since we 
aren't familiar with your code.

Original comment by shai.almog on 8 Feb 2015 at 3:20

GoogleCodeExporter commented 9 years ago
I already specified where the issue was. If I do not use TreeSet it will
work.
Most of the code is just to dummy up the data which is the same data that I
use for testing.
The issue is not critical, I just won't use TreeSet to make it work.

Anyway, have removed some code.

Original comment by alnguyen...@gmail.com on 8 Feb 2015 at 9:38

GoogleCodeExporter commented 9 years ago
That's not code I can compile and run. There are many imports in it that point 
to your classes/libraries.

Original comment by shai.almog on 9 Feb 2015 at 7:35

GoogleCodeExporter commented 9 years ago
The file is self contained. These are all the imports which point to
codename1 or java libraries.

import com.codename1.ui.Container;
import com.codename1.ui.Display;
import com.codename1.ui.Form;
import com.codename1.ui.Label;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import java.io.IOException;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;

Original comment by alnguyen...@gmail.com on 9 Feb 2015 at 8:57