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

Fix auto-res namespace handling #1847

Merged
merged 1 commit into from
May 28, 2015
Merged

Fix auto-res namespace handling #1847

merged 1 commit into from
May 28, 2015

Conversation

lexs
Copy link
Contributor

@lexs lexs commented May 28, 2015

@holmari notified me that 8d0e029 might cause a regression in regards to library handling. This is because resources from a library project will have http://schemas.android.com/apk/res-auto replaced with the library package name instead of the application package name.

This commit changes this so we never actually replace package names but instead look up by http://schemas.android.com/apk/res-auto if looking up by package name fail. I don't have a specific test case but regression tests pass.

@holmari
Copy link
Contributor

holmari commented May 28, 2015

I tested this locally. It fixes the regression - we had 18 tests cases that failed earlier, but they pass now with this patch.

erd added a commit that referenced this pull request May 28, 2015
Fix auto-res namespace handling
@erd erd merged commit 6908164 into robolectric:master May 28, 2015
@lexs lexs deleted the fix-auto branch May 28, 2015 17:00
@jongerrish
Copy link
Contributor

I think this PR might have caused some breakages in our build:-

On one project:-
Caused by: java.lang.RuntimeException: no value found for true
at org.robolectric.shadows.Converter$EnumOrFlagConverter.findValueFor(Converter.java:431)
at org.robolectric.shadows.Converter$EnumConverter.fillTypedValue(Converter.java:394)
at org.robolectric.shadows.Converter$EnumConverter.fillTypedValue(Converter.java:386)
at org.robolectric.shadows.Converter.convertAndFill(Converter.java:157)
at org.robolectric.shadows.Converter.convertAndFill(Converter.java:50)
at org.robolectric.shadows.ShadowResources.createTypedArray(ShadowResources.java:232)
at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:209)
at org.robolectric.shadows.ShadowResources.access$000(ShadowResources.java:55)
at org.robolectric.shadows.ShadowResources$ShadowTheme.obtainStyledAttributes(ShadowResources.java:485)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.robolectric.internal.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:437)
at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java)
at android.widget.TextView.$$robo$$constructor(TextView.java:752)
at android.widget.TextView.(TextView.java)
at android.widget.TextView.(TextView.java)

On another:-

Caused by: java.lang.NumberFormatException: For input string: "/path/to/resources/color/some_resource.xml"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:481)
at com.android.internal.util.XmlUtils.convertValueToInt(XmlUtils.java:122)
at android.content.res.TypedArray.getInt(TypedArray.java:255)
at android.widget.ImageView.constructor(ImageView.java:155)
at android.widget.ImageView.(ImageView.java)
at android.widget.ImageButton.(ImageButton.java)

@lexs
Copy link
Contributor Author

lexs commented May 29, 2015

@jongerrish Ugh, I'll see if I can figure something out during the day. The resource code is icky and hard to test as you and @holmari have conflicting cases here. It would be nice to have a few samples that we test against that can be more complex.

By the way it looks like you have stack trace filtering off, is this for performance reasons?

@jongerrish
Copy link
Contributor

It's for confidentiality reasons I can't leak stack traces unfortunately...

...let me know if you have any questions I'll see what info I can provide.
On May 29, 2015 1:49 AM, "Alexander Blom" notifications@github.com wrote:

@jongerrish https://github.com/jongerrish Ugh, I'll see if I can figure
something out during the day. The resource code is icky and hard to test as
you and @holmari https://github.com/holmari have conflicting cases
here. It would be nice to have a few samples that we test against that can
be more complex.

By the way it looks like you have stack trace filtering off, is this for
performance reasons?


Reply to this email directly or view it on GitHub
#1847 (comment)
.

@lexs
Copy link
Contributor Author

lexs commented May 29, 2015

@jongerrish Would be great if you could give #1851 a try.

@jongerrish
Copy link
Contributor

I just ran this through our submit queue and it works. Previous failures are fixed and no new failures. I'll go ahead and merge this. Thanks for the quick response.

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

Successfully merging this pull request may close these issues.

4 participants