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

NPE In ConvertersConfigurationInitializer under unit test when using RestBuilder #9611

Closed
ctoestreich opened this issue Jan 30, 2016 · 3 comments
Assignees
Milestone

Comments

@ctoestreich
Copy link
Contributor

A NPE in unit tests when calling services that use new RestBuilder() and that use the default JSON marshalling as this will get invoked and then cause NPE on getConfig() on this line: [https://github.com/grails/grails-core/blob/fea97e8624b9428d7e987dce41a037d12004d409/grails-plugin-converters/src/main/groovy/org/grails/web/converters/configuration/ConvertersConfigurationInitializer.java#L98]

Previously in the 3.0.x branch this would work okay due to how the config was initialized. I attempting to rework the tests to accommodate this change, but I am having now luck.

The exception starts from the call to def rest = new RestBuilder()

Grails 3.1.0
JDK 1.8u72

When setting the grailsApplication via ConvertersConfigurationInitializer.metaClass.grailsApplication = grailsApplication then a new issue arrises where cacheContext throws a MissingPropertyException at [https://github.com/grails/grails-core/blob/970a95981a7bc83ed9d3b600866895a1cfb8c607/grails-plugin-testing/src/main/groovy/grails/test/runtime/GrailsApplicationTestPlugin.groovy#L342] Although this appears to be caught and ignored.

screen shot 2016-01-29 at 9 01 20 pm

screen shot 2016-01-29 at 9 23 04 pm

screen shot 2016-01-29 at 9 24 05 pm

@ctoestreich
Copy link
Contributor Author

@ctoestreich
Copy link
Contributor Author

I am actually going to leave this open for @graemerocher or @jeffbrown to decide whether this issue is WAD or something that needs to be fixed.

@ctoestreich
Copy link
Contributor Author

NVM, I see your second commit! ;) Cheers!

jdaugherty pushed a commit to jdaugherty/grails-core that referenced this issue Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants