Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
getodk-bot opened this issue Sep 5, 2016 · 3 comments
Labels

Comments

@getodk-bot
Copy link
Member

Issue by mitchellsundt
Thursday Jul 09, 2015 at 19:33 GMT
Originally opened as getodk/getodk#914 (2 comment(s))


Originally reported on Google Code with ID 913

Reported by:

Tumaini Kilimba
[email protected]

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.java: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(FormEntryActivity.java:1166)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at org.odk.collect.android.activities.FormEntryActivity.onFling(FormEntryActivity.java: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(FormEntryActivity.java:1149)
09-12 13:29:10.490: E/MessageQueue-JNI(13233): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.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.java: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

Reported by mitchellsundt on 2013-09-12 21:17:35

@getodk-bot
Copy link
Member Author

Comment by mitchellsundt
Thursday Jul 09, 2015 at 19:33 GMT


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.


Reported by mitchellsundt on 2013-09-12 21:18:58

@getodk-bot
Copy link
Member Author

Comment by mitchellsundt
Thursday Jul 09, 2015 at 19:33 GMT


Reported by mitchellsundt on 2013-09-12 21:19:30

@grzesiek2010
Copy link
Member

grzesiek2010 commented Nov 20, 2017

@lognaturel
I'm not able to reproduce that crash there is only a small bug:
If I navigate back and select "no" I'm still able to see repeat groups. I think it's related to getodk/javarosa#61 so let's continue the discussion there and close this issue.

I used this form:
repeatTest.xml.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants