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

Add null safety for any use of ReaderSource.getURI() #11278

Closed
2 of 4 tasks
AntonPanikov opened this issue Mar 21, 2019 · 3 comments
Closed
2 of 4 tasks

Add null safety for any use of ReaderSource.getURI() #11278

AntonPanikov opened this issue Mar 21, 2019 · 3 comments
Assignees
Milestone

Comments

@AntonPanikov
Copy link

Task List

  • Steps to reproduce provided
  • Stacktrace (if present) provided
  • Example that reproduces the problem uploaded to Github
  • Full description of the issue provided (see below)

Environment Information

  • Grails Version: 3.2.x

I am helping troubleshooting GRECLIPSE plugin issue: groovy/groovy-eclipse#850

It looks like MainClassFinder.groovy is not null safe enough. URI path is coming from ReaderSource.java
from
IntegrationTestMixinTransformation.groovy

and for example this two implementations of ReaderSource:
StringReaderSource.java
and
InputStreamReaderSource.java
is returning null, the first one at some conditions, the second one - always.

Missing null safety causing NPE in GRECLIPSE current implementation

Partial stack trace will look like this:

Caused by: java.lang.NullPointerException
	at org.grails.io.support.MainClassFinder.searchMainClass(MainClassFinder.groovy:38)
	at org.grails.compiler.injection.test.TestMixinTransformation.visit(TestMixinTransformation.java:113)
	at org.codehaus.groovy.transform.ASTTransformationVisitor.visitClass(ASTTransformationVisitor.java:197)
	at org.codehaus.groovy.transform.ASTTransformationVisitor$2.call(ASTTransformationVisitor.java:258)
	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1143)
	... 8 more
@ddelponte
Copy link
Contributor

@AntonPanikov, the last comment on the ticket at groovy/groovy-eclipse#850 is:

Verified on:
3.3.0.xx-201903212137-e1809

No issue, no errors. Thanks!

Can this ticket be closed or is it still an issue?

@AntonPanikov
Copy link
Author

The other issue was fixed in: groovy/groovy-eclipse#850
But I think it was a workaround about the fact that MainClassFinder.groovy may throw NPE, while it should not. This issue was about providing more null safe code for the future versions of grails, that might or might not bite back at some point, see my original comment. It is up to you guys to do something about it or not.

Thanks!

@ddelponte
Copy link
Contributor

PR created: #11323

graemerocher added a commit that referenced this issue May 16, 2019
Issue #11278: Add null safety for any use of ReaderSource.getURI()
@graemerocher graemerocher added this to the grails-4.0.0 milestone May 16, 2019
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

3 participants