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

meta tags required #13

Closed
RasmusKOlsen opened this Issue Mar 11, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@RasmusKOlsen

RasmusKOlsen commented Mar 11, 2015

(copy from Stuart-campbell/RushCore#1 - looks like i managed to post in a wrong repo)

Hi.

I found what seems to be either a documentation or an implementation error.

The meta tags seems to be required in the android manifest, or a null pointer is thrown:

<!-- Database name -->
<meta-data android:name="Rush_db_name" android:value="poly.danalock.db" />

<!-- Setting this to true will cause a migration to happen every launch,
this is very handy during development although could cause data loss -->
<meta-data android:name="Rush_debug" android:value="false" />

<!-- Setting this to true mean that tables will only be created of classes that
extend RushObject and are annotated with @RushTableAnnotation -->
<meta-data android:name="Rush_requires_table_annotation" android:value="false" />

The error seems to happen in AndroidRushConfig.java line 32 - it is expected that meta tags are defined within the application.

For clarity it might also be worth changing the documentation regarding these meta tags to make it clear that they should be childs of theapplication tag.

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell Mar 11, 2015

Owner

Hi,

Thanks for reposting.

Yeah you are correct they need to be in the application tag. I will add a side note in the docs to make that clear.

Are you actually getting a null pointer if they are not included? All the meta-data tags should have default fall backs if not specified.

Thanks

Owner

Stuart-campbell commented Mar 11, 2015

Hi,

Thanks for reposting.

Yeah you are correct they need to be in the application tag. I will add a side note in the docs to make that clear.

Are you actually getting a null pointer if they are not included? All the meta-data tags should have default fall backs if not specified.

Thanks

@RasmusKOlsen

This comment has been minimized.

Show comment
Hide comment
@RasmusKOlsen

RasmusKOlsen Mar 11, 2015

yes, if I do not include them I get a null pointer.

From a quick glance at the code it seems to be AndroidRushConfig.java at line 32, part of my stacktrace:
Caused by: java.lang.NullPointerException
at co.uk.rushorm.android.AndroidRushConfig.(AndroidRushConfig.java:32)
at co.uk.rushorm.android.RushAndroid.initialize(RushAndroid.java:29)
at co.uk.rushorm.android.RushAndroid.initialize(RushAndroid.java:23)
....MainApplication.onCreate(MainApplication.java:19)

So it happens before there is a chance for the default values be assinged.
For the record I tested it on android 4.4 using genymotion.

RasmusKOlsen commented Mar 11, 2015

yes, if I do not include them I get a null pointer.

From a quick glance at the code it seems to be AndroidRushConfig.java at line 32, part of my stacktrace:
Caused by: java.lang.NullPointerException
at co.uk.rushorm.android.AndroidRushConfig.(AndroidRushConfig.java:32)
at co.uk.rushorm.android.RushAndroid.initialize(RushAndroid.java:29)
at co.uk.rushorm.android.RushAndroid.initialize(RushAndroid.java:23)
....MainApplication.onCreate(MainApplication.java:19)

So it happens before there is a chance for the default values be assinged.
For the record I tested it on android 4.4 using genymotion.

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell Mar 11, 2015

Owner

Sounds like bundle is null at this point.

ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;

Ill put a null check in.

Thanks

Owner

Stuart-campbell commented Mar 11, 2015

Sounds like bundle is null at this point.

ApplicationInfo ai = context.getPackageManager().getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
Bundle bundle = ai.metaData;

Ill put a null check in.

Thanks

@Stuart-campbell Stuart-campbell added the bug label Mar 11, 2015

Stuart-campbell added a commit that referenced this issue Mar 16, 2015

@Stuart-campbell

This comment has been minimized.

Show comment
Hide comment
@Stuart-campbell

Stuart-campbell Mar 16, 2015

Owner

Hi, Sorry I was a bit slow on this one. Resolved now.

Cheers

Owner

Stuart-campbell commented Mar 16, 2015

Hi, Sorry I was a bit slow on this one. Resolved now.

Cheers

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