mohan-nishit / opendatakit

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

Cannot edit saved forms #292

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a form that contains a spinner widget
2. Start a New Form and partially complete it (but don't mark as complete
3. Continue Saved Form and try to edit the previously saved form
4. Collect then crashes complaining that a Vector cannot be cast into a 
Selection

What is the expected output? What do you see instead?
Expected to be able to edit the saved form but the application crashed instead

What version of the product are you using? On what operating system?
1.1.7 Beta, 1.1.7RC1 and code in repository. This problem did not exist in 1.1.5

Please provide any additional information below.
After some debugging - I found that the application crashed in 
org/odk/collect/android/widgets/SpinnerWidget.java line 74 i.e.

71        // Fill in previous answer
72        String s = null;
73        if (prompt.getAnswerValue() != null) {
74            s = ((Selection) prompt.getAnswerValue().getValue()).getValue();
75        }

I managed to fix it with the following code (note - I don't understand the 
codebase at all so this should be considered to be a makeshift plug rather than 
a well though-out fix)

        // Fill in previous answer
        String s = null;
        if (prompt.getAnswerValue() != null) {
            Object o = prompt.getAnswerValue().getValue();
            if (o instanceof Vector)
                s = ((Selection)((Vector)o).get(0)).getValue();
            else if (o instanceof Selection)
                s = ((Selection)o).getValue();
        }

Original issue reported on code.google.com by a...@burgercom.co.za on 5 Aug 2011 at 7:07

GoogleCodeExporter commented 9 years ago

Original comment by wbrune...@gmail.com on 5 Aug 2011 at 7:32

GoogleCodeExporter commented 9 years ago
jeff is working on this one.

Original comment by yanokwa on 6 Aug 2011 at 3:22

GoogleCodeExporter commented 9 years ago
I'm not sure what checkin fixed this, but it appears to be working now.

Original comment by carlhart...@gmail.com on 27 Sep 2011 at 9:13

GoogleCodeExporter commented 9 years ago
Just checked this on the code in the repository. It is still happening. See 
this following stack trace

E/Carl    (  488): adding spinner, for reals
W/System.err(  488): java.lang.ClassCastException: java.lang.String cannot be 
cast to org.javarosa.core.model.data.helper.Selection
W/System.err(  488):    at 
org.odk.collect.android.widgets.SpinnerWidget.<init>(SpinnerWidget.java:74)
W/System.err(  488):    at 
org.odk.collect.android.widgets.WidgetFactory.createWidgetFromPrompt(WidgetFacto
ry.java:104)
W/System.err(  488):    at 
org.odk.collect.android.views.ODKView.<init>(ODKView.java:86)
W/System.err(  488):    at 
org.odk.collect.android.activities.FormEntryActivity.createView(FormEntryActivit
y.java:718)
W/System.err(  488):    at 
org.odk.collect.android.activities.FormEntryActivity.showPreviousView(FormEntryA
ctivity.java:830)
W/System.err(  488):    at 
org.odk.collect.android.activities.FormEntryActivity.onFling(FormEntryActivity.j
ava:1590)
W/System.err(  488):    at 
android.view.GestureDetector.onTouchEvent(GestureDetector.java:568)
W/System.err(  488):    at 
org.odk.collect.android.activities.FormEntryActivity.dispatchTouchEvent(FormEntr
yActivity.java:746)
W/System.err(  488):    at 
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneW
indow.java:1683)
W/System.err(  488):    at android.view.View.dispatchPointerEvent(View.java:4677)
W/System.err(  488):    at 
android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2348)
W/System.err(  488):    at android.view.ViewRoot.handleMessage(ViewRoot.java:2017)
W/System.err(  488):    at android.os.Handler.dispatchMessage(Handler.java:99)
W/System.err(  488):    at android.os.Looper.loop(Looper.java:132)
W/System.err(  488):    at 
android.app.ActivityThread.main(ActivityThread.java:4025)
W/System.err(  488):    at java.lang.reflect.Method.invokeNative(Native Method)
W/System.err(  488):    at java.lang.reflect.Method.invoke(Method.java:491)
W/System.err(  488):    at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
W/System.err(  488):    at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
W/System.err(  488):    at dalvik.system.NativeStart.main(Native Method)

Original comment by a...@burgercom.co.za on 2 Oct 2011 at 11:24

GoogleCodeExporter commented 9 years ago

Original comment by yanokwa on 3 Oct 2011 at 3:26

GoogleCodeExporter commented 9 years ago
can you attach the form that's causing this?

Original comment by carlhart...@gmail.com on 3 Oct 2011 at 4:14

GoogleCodeExporter commented 9 years ago

Original comment by yanokwa on 25 May 2012 at 8:11

GoogleCodeExporter commented 9 years ago
Closing this as it hasn't be reproduced.

Original comment by mitchellsundt@gmail.com on 29 Jun 2012 at 11:47