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

NumberFormatException when deserializing specific member constellation #34

Closed
nis73 opened this Issue May 7, 2015 · 10 comments

Comments

Projects
None yet
2 participants
@nis73

nis73 commented May 7, 2015

Hi, I'm having an onject similar to the following one:

public class MyObject extends RushObject {

    public static final int CONST = 0;
    private int firstInt = 30;
    private boolean firstBool = false;

    public MyObject() {
    }
}

When I write the object to the database and read it again, like in this code ...

public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        MyObject obj = new MyObject();
        obj.save();
        System.out.println("saved object");
        System.out.println(new RushSearch().find(MyObject.class));
    }
}

... I get a NumberFormatException:

05-07 17:52:44.110  19742-19742/de.test.testrushorm E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.RuntimeException: Unable to start activity ComponentInfo{de.test.testrushorm/de.test.testrushorm.MainActivity}: java.lang.NumberFormatException: Invalid int: "false"
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2078)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2103)
            at android.app.ActivityThread.access$600(ActivityThread.java:137)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4827)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.NumberFormatException: Invalid int: "false"
            at java.lang.Integer.invalidInt(Integer.java:138)
            at java.lang.Integer.parse(Integer.java:375)
            at java.lang.Integer.parseInt(Integer.java:366)
            at java.lang.Integer.parseInt(Integer.java:332)
            at co.uk.rushorm.core.implementation.RushColumnInt.deserialize(RushColumnInt.java:22)
            at co.uk.rushorm.core.implementation.RushColumnInt.deserialize(RushColumnInt.java:9)
            at co.uk.rushorm.core.implementation.RushColumnsImplementation.setField(RushColumnsImplementation.java:50)
            at co.uk.rushorm.core.implementation.ReflectionClassLoader.loadClass(ReflectionClassLoader.java:99)
            at co.uk.rushorm.core.implementation.ReflectionClassLoader.loadClasses(ReflectionClassLoader.java:54)
            at co.uk.rushorm.core.implementation.ReflectionClassLoader.loadClasses(ReflectionClassLoader.java:42)
            at co.uk.rushorm.core.RushCore.load(RushCore.java:577)
            at co.uk.rushorm.core.RushCore.load(RushCore.java:232)
            at co.uk.rushorm.core.RushSearch.find(RushSearch.java:40)
            at de.test.testrushorm.MainActivity.onCreate(MainActivity.java:22)
            at android.app.Activity.performCreate(Activity.java:5013)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2042)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2103)
            at android.app.ActivityThread.access$600(ActivityThread.java:137)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1211)
            at android.os.Handler.dispatchMessage(Handler.java:99)
            at android.os.Looper.loop(Looper.java:137)
            at android.app.ActivityThread.main(ActivityThread.java:4827)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:511)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:608)
            at dalvik.system.NativeStart.main(Native Method)

The curious thing is that this happens only in the class member constellation given above. If I either omit the Integer, the Boolean or the constant - it works :)
One more information: The problem encountered since version 1.1.3.

Thanks in advance.

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell May 7, 2015

Owner

Hi,

I can't seem to reproduce this. Is rush_debug true?

Thanks

Owner

Stuart-campbell commented May 7, 2015

Hi,

I can't seem to reproduce this. Is rush_debug true?

Thanks

@nis73

This comment has been minimized.

Show comment
Hide comment
@nis73

nis73 May 8, 2015

Hi,

yes, rush_debug is true. The crash occures on a Huawei G525. I tested it on a XPeria Z3 now and there it works. Really strange. I'm going to test it on some other devices.

nis73 commented May 8, 2015

Hi,

yes, rush_debug is true. The crash occures on a Huawei G525. I tested it on a XPeria Z3 now and there it works. Really strange. I'm going to test it on some other devices.

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell May 8, 2015

Owner

Is there any change that one of your variables type was redefined at some point? The migration does not support changing type. Might be worth fully uninstalling and reinstalling to rule that out.

Owner

Stuart-campbell commented May 8, 2015

Is there any change that one of your variables type was redefined at some point? The migration does not support changing type. Might be worth fully uninstalling and reinstalling to rule that out.

@nis73

This comment has been minimized.

Show comment
Hide comment
@nis73

nis73 May 8, 2015

No, I'm using the example described above - only the MyObject class and the code from MainActivity, and it is reproducable after full uninstall. Is it helpful if I send you the example code?

nis73 commented May 8, 2015

No, I'm using the example described above - only the MyObject class and the code from MainActivity, and it is reproducable after full uninstall. Is it helpful if I send you the example code?

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell May 8, 2015

Owner

Yeah I can take a look. Don't have access to a Huawei G525 lots of samsung and htcs but no Huawei.

Owner

Stuart-campbell commented May 8, 2015

Yeah I can take a look. Don't have access to a Huawei G525 lots of samsung and htcs but no Huawei.

@nis73

This comment has been minimized.

Show comment
Hide comment
@nis73

nis73 May 8, 2015

I was able to reproduce the error on a Samsung SM-T315 (Galaxy Tab) now.
Could it be related to the Android version? The Huawei phone has Android 4.1.2 and the Samsung tablet has 4.4.2. The X-Peria Z3 has Android 5.0 - here it worked.

nis73 commented May 8, 2015

I was able to reproduce the error on a Samsung SM-T315 (Galaxy Tab) now.
Could it be related to the Android version? The Huawei phone has Android 4.1.2 and the Samsung tablet has 4.4.2. The X-Peria Z3 has Android 5.0 - here it worked.

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell May 8, 2015

Owner

The sqlite version did change from 3.7 to 3.8 between those Android version. I'll have a proper look into it and get back to you.

Owner

Stuart-campbell commented May 8, 2015

The sqlite version did change from 3.7 to 3.8 between those Android version. I'll have a proper look into it and get back to you.

@Stuart-campbell Stuart-campbell added the bug label May 9, 2015

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell May 9, 2015

Owner

Found the cause of this bug, was because of the final static. Should have a fix this weekend.

Thanks

Owner

Stuart-campbell commented May 9, 2015

Found the cause of this bug, was because of the final static. Should have a fix this weekend.

Thanks

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell May 11, 2015

Owner

Hi,

This should now be fixed in 1.1.5

Cheers

Owner

Stuart-campbell commented May 11, 2015

Hi,

This should now be fixed in 1.1.5

Cheers

@nis73

This comment has been minimized.

Show comment
Hide comment
@nis73

nis73 May 12, 2015

It works now. Thanks for the quick fix.

nis73 commented May 12, 2015

It works now. Thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment