osayouba / opendatakit

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

jr:repeat-count crashes after going back and changing values that specify a new count limit. #913

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Reported by:

Tumaini Kilimba
tkilimba@ihi.or.tz

Dear Sirs/Madam,
I am currently working on a form which does:

1. Ask if there are mosquito nets in the household (select1 question, YES/NO)
2. Ask for the number of mosquito nets (int) (relevant if answer to above is 
YES)
3. Loop for each mosquito net (using the above answer to inform jr:count)
   * Ask mosquito net specific questions.

If the fieldworker goes through the process in a linear fashion (no going back 
to amend previous answers) there is no problem. However if the user goes from 
step 1-3, then suddenly goes back to step 1 and change the response from YES to 
NO (rendering step two irrelevant), there is a crash, stack trace below:

09-12 13:29:10.480: E/InputEventReceiver(13233): Exception dispatching input 
event.
09-12 13:29:10.480: E/MessageQueue-JNI(13233): Exception in MessageQueue 
callback: handleReceiveCallback
09-12 13:29:10.490: E/MessageQueue-JNI(13233): 
java.lang.ArrayIndexOutOfBoundsException: length=0; index=0
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
java.util.Vector.arrayIndexOutOfBoundsException(Vector.java:907)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
java.util.Vector.elementAt(Vector.java:328)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.xpath.XPathNodeset.getRefAt(XPathNodeset.java:54)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.xpath.expr.XPathFuncExpr.eval(XPathFuncExpr.java:185)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.xpath.XPathConditional.evalRaw(XPathConditional.java:68)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.core.model.condition.Recalculate.eval(Recalculate.java:53)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.core.model.condition.Triggerable.apply(Triggerable.java:69)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.core.model.FormDef.evaluateTriggerable(FormDef.java:708)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.core.model.FormDef.evaluateTriggerables(FormDef.java:698)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.core.model.FormDef.triggerTriggerables(FormDef.java:671)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.core.model.FormDef.setValue(FormDef.java:305)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.form.api.FormEntryController.commitAnswer(FormEntryController.java:
155)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.javarosa.form.api.FormEntryController.answerQuestion(FormEntryController.jav
a:92)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.odk.collect.android.logic.FormController.answerQuestion(FormController.java:
406)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.odk.collect.android.logic.FormController.saveAllScreenAnswers(FormController
.java:677)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.odk.collect.android.activities.FormEntryActivity.saveAnswersForCurrentScreen
(FormEntryActivity.java:804)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.odk.collect.android.activities.FormEntryActivity.showNextView(FormEntryActiv
ity.java:1166)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.odk.collect.android.activities.FormEntryActivity.onFling(FormEntryActivity.j
ava:2467)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.GestureDetector.onTouchEvent(GestureDetector.java:609)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
org.odk.collect.android.activities.FormEntryActivity.dispatchTouchEvent(FormEntr
yActivity.java:1149)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneW
indow.java:1914)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.View.dispatchPointerEvent(View.java:7564)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl
.java:3883)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3778
)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3483)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3540)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3429)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3398)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3406)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3379)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5419)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5399)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5370)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.jav
a:5493)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:182)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.os.MessageQueue.nativePollOnce(Native Method)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.os.MessageQueue.next(MessageQueue.java:132)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.os.Looper.loop(Looper.java:124)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
android.app.ActivityThread.main(ActivityThread.java:5103)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
java.lang.reflect.Method.invokeNative(Native Method)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
java.lang.reflect.Method.invoke(Method.java:525)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at 
dalvik.system.NativeStart.main(Native Method)

I believe this is because the jr:count value  for the question 3 loop changes 
because question 2 is no longer relevant. Does anyone have a suggestion how 
this could be implemented? I was trying to do an 

PSEUDOCODE:
  If(selected(qtn1,'NO') then currentNode=0, else currentNode==userInput)
ACTUAL CODE:
  <bind nodeset="/form/agepassed/q23" calculate="if(selected(/form/agepassed/q22, '0') , 0,'/form/agepassed/q23)" ... />

This resulted in cyclic dependency errors due to the ELSE part of the 
conditional. In reality I only want the IF-THEN, I dont need the ELSE..

  <bind nodeset="/form/agepassed/q23" calculate="if(selected(/form/agepassed/q22, '0') , 0)" ... />

But javarosa syntax insists on the ELSE clause.

Any help greatly appreciated

Tumaini

Original issue reported on code.google.com by mitchellsundt@gmail.com on 12 Sep 2013 at 9:17

GoogleCodeExporter commented 9 years ago
This is likely related to several other repeat-count issues where the repeat 
count does not respect changes -- e.g., if the number or repeats should be 
reduced.

Original comment by mitchellsundt@gmail.com on 12 Sep 2013 at 9:18

GoogleCodeExporter commented 9 years ago

Original comment by mitchellsundt@gmail.com on 12 Sep 2013 at 9:19