anupmishra20 / opendatakit

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

runtime crash from bad formdef #386

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
"Hello ODK,
  attached is a survey designed using purcforms. I ran it on ODK Collect 1.5 and got some strange behaviour. It loads fine but when you save it after a question or two and then go to Continue Saved Form to resume, the app force closes. Attached is the output from logcat which seems to suggest that perhaps some of the attributes in the form are not constructed properly. I looked and did not find any suspicious ones. I would appreciate any pointers in getting this fixed.
Also, if anyone could try running it in Collect 1.7 just in case it has 
something to do with a javarosa upgrade, that would be great."
-- richard

running this through validate 1.5 produces the following unique warnings..

Warning: 1 Unrecognized attributes found in Element [bind] and will be ignored: 
[action] Location:
Warning: 1 Unrecognized attributes found in Element [bind] and will be ignored: 
[format] Location:
Warning: 1 Unrecognized attributes found in Element [item] and will be ignored: 
[id] Location:
Warning: 1 Unrecognized attributes found in Element [title] and will be 
ignored: [ref] Location:
Warning: 1 Unrecognized attributes found in Element [translation] and will be 
ignored: [lang-name] Location:
Warning: 1 Unrecognized attributes found in Eleme®nt [group] and will be 
ignored: [id] Location:
Warning: 2 Unrecognized attributes found in Element [afrobarometerr5] and will 
be ignored: [name,id] Location:
Warning: 2 Unrecognized attributes found in Element [bind] and will be ignored: 
[action,visible] Location:
Warning: 2 Unrecognized attributes found in Element [bind] and will be ignored: 
[visible,action] Location:
WARNING: Bind [/afrobarometer_r5/q16/q17] matches no nodes; ignoring bind...
WARNING: Bind [/afrobarometer_r5/q18/q19] matches no nodes; ignoring bind...
WARNING: Bind [/afrobarometer_r5/q406] matches no nodes; ignoring bind...

problem occurs in when you load the a pre-processed form def -- i don't think 
you have to even load a saved instance.

FATAL EXCEPTION: AsyncTask #2
java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:200)
    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
    at java.lang.Thread.run(Thread.java:1019)
Caused by: java.lang.StringIndexOutOfBoundsException
    at java.lang.String.substring(String.java:1651)
    at org.javarosa.core.model.instance.TreeElement.addSingleAttribute(TreeElement.java:596)
    at org.javarosa.core.model.instance.TreeElement.setAttributesFromSingleStringVector(TreeElement.java:567)
    at org.javarosa.core.model.instance.TreeElement.readExternal(TreeElement.java:683)
    at org.javarosa.core.model.instance.TreeElement.readExternal(TreeElement.java:658)
    at org.javarosa.core.util.externalizable.ExtUtil.read(ExtUtil.java:160)
    at org.javarosa.core.model.instance.FormInstance.readExternal(FormInstance.java:471)
    at org.javarosa.core.util.externalizable.ExtUtil.read(ExtUtil.java:160)
    at org.javarosa.core.model.FormDef.readExternal(FormDef.java:981)
    at org.odk.collect.android.tasks.FormLoaderTask.deserializeFormDef(FormLoaderTask.java:282)
    at org.odk.collect.android.tasks.FormLoaderTask.doInBackground(FormLoaderTask.java:132)
    at org.odk.collect.android.tasks.FormLoaderTask.doInBackground(FormLoaderTask.java:1)
    at android.os.AsyncTask$2.call(AsyncTask.java:185)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)
    ... 4 more
   Force finishing activity org.odk.collect.android/.activities.FormEntryActivity

Original issue reported on code.google.com by yanokwa on 22 Oct 2011 at 4:56

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by yanokwa on 22 Oct 2011 at 4:57

GoogleCodeExporter commented 9 years ago
This is a javarosa bug.  Should be filed there.

Original comment by carlhart...@gmail.com on 25 Oct 2011 at 11:49

GoogleCodeExporter commented 9 years ago
filed at 
https://bitbucket.org/javarosa/javarosa/issue/53/core-produces-corrupt-formdef.

the combination of purc forms and the core is causing this problem. best we can 
do is catch these runtime exceptions so it doesn't crash, but that's carl's 
call.

Original comment by yanokwa on 26 Oct 2011 at 5:00

GoogleCodeExporter commented 9 years ago
Turns out lines 292 and 293 which have a style attribute are responsible for 
the crash. Took out that attribute and the form worked fine. The style 
attribute being added was a  
purcforms bug, but JR\ODK should be able to gracefully handle it instead of 
crashing :)

Original comment by snsub...@applab.org on 26 Oct 2011 at 2:00

GoogleCodeExporter commented 9 years ago

Original comment by yanokwa on 2 Nov 2011 at 10:27

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

Original comment by yanokwa on 2 Nov 2011 at 10:31