1. Java Rosa
  2. javarosa
  3. Issues
Issue #53 new

core produces corrupt formdef

Yaw Anokwa
created an issue

"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 warnings (piped thru sort | uniq)

{{{ 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 }}}

Comments (1)

  1. Yaw Anokwa reporter

    "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 :)" -- richard

  2. Log in to comment