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 NPE in SpringReference #4691

Merged
merged 1 commit into from
Nov 20, 2024
Merged

Fix NPE in SpringReference #4691

merged 1 commit into from
Nov 20, 2024

Conversation

Laurens-W
Copy link
Contributor

What's your motivation?

Failure reported on platform

Anyone you would like to review specifically?

@knutwannheden

Have you considered any alternatives or workarounds?

Any additional context

Error:

Message:

Cannot invoke "org.openrewrite.xml.tree.Xml$Tag.getAttributes()" because the return value of "org.openrewrite.xml.tree.Xml$Document.getRoot()" is null

Detail:

java.lang.NullPointerException: Cannot invoke "org.openrewrite.xml.tree.Xml$Tag.getAttributes()" because the return value of "org.openrewrite.xml.tree.Xml$Document.getRoot()" is null
org.openrewrite.xml.trait.SpringReference$Provider.isAcceptable(SpringReference.java:118)
org.openrewrite.SourceFileWithReferences$References.lambda$build$0(SourceFileWithReferences.java:59)
java.base/java.lang.Iterable.forEach(Iterable.java:75)
org.openrewrite.SourceFileWithReferences$References.build(SourceFileWithReferences.java:58)
org.openrewrite.xml.tree.Xml$Document.getReferences(Xml.java:179)
org.openrewrite.java.search.UsesType.visit(UsesType.java:124)
org.openrewrite.TreeVisitor.visitNonNull(TreeVisitor.java:170)
org.openrewrite.java.ChangeType$1.preVisit(ChangeType.java:95)
org.openrewrite.java.ChangeType$1.preVisit(ChangeType.java:83)
org.openrewrite.TreeVisitor.visit(TreeVisitor.java:247)
org.openrewrite.TreeVisitor.visit(TreeVisitor.java:157)
org.openrewrite.Preconditions$Check.visit(Preconditions.java:174)
org.openrewrite.Preconditions$Check.visit(Preconditions.java:145)
org.openrewrite.scheduling.RecipeRunCycle.lambda$editSources$6(RecipeRunCycle.java:186)
io.micrometer.core.instrument.AbstractTimer.recordCallable(AbstractTimer.java:178)
org.openrewrite.table.RecipeRunStats.recordEdit(RecipeRunStats.java:67)
...

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

@Laurens-W Laurens-W added the bug Something isn't working label Nov 20, 2024
@Laurens-W Laurens-W self-assigned this Nov 20, 2024
@Laurens-W Laurens-W marked this pull request as ready for review November 20, 2024 17:27
@Laurens-W Laurens-W merged commit 804ca6a into main Nov 20, 2024
2 checks passed
@Laurens-W Laurens-W deleted the fix-npe-on-springreference branch November 20, 2024 17:27
MBoegers pushed a commit to MBoegers/rewrite that referenced this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants