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

rare NPE in classpath listener #966

Closed
martinlippert opened this issue Feb 1, 2023 · 2 comments
Closed

rare NPE in classpath listener #966

martinlippert opened this issue Feb 1, 2023 · 2 comments
Assignees
Labels
for: eclipse something that is specific for Eclipse theme: internal-architecture type: bug

Comments

@martinlippert
Copy link
Member

It seems like I have hit a rare moment in time where the editor for the pom.xml file wasn't fully initialized yet when we tried to grab classpath information:

java.lang.NullPointerException: Cannot invoke "org.eclipse.ui.texteditor.ITextEditor.getAdapter(java.lang.Class)" because "this.sourcePage" is null
	at org.eclipse.m2e.editor.pom.MavenPomEditor.getAdapter(MavenPomEditor.java:1013)
	at org.springframework.tooling.ls.eclipse.commons.STS4LanguageClientImpl.lambda$9(STS4LanguageClientImpl.java:423)
	at org.springframework.tooling.jdt.ls.commons.classpath.ReusableClasspathListenerHandler$CallbackJob.lambda$0(ReusableClasspathListenerHandler.java:76)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.tooling.jdt.ls.commons.classpath.ReusableClasspathListenerHandler$CallbackJob.run(ReusableClasspathListenerHandler.java:76)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

This is probably hard to reproduce. It happened when I created a Rest Service sample project right after starting up a fresh install of STS 4.17.2 with a fresh workspace, opened the pom.xml file, and pressed Yes on the reconcile popup - almost everything at the same time.

@BoykoAlex
Copy link
Contributor

It would have been best if MavenPomEditor doesn't throw an NPE in this case: eclipse-m2e/m2e-core#1235

On our side i think we should catch and log exceptions without short-circuiting the loop: 5d9eee9

@BoykoAlex
Copy link
Contributor

I'll close it. Also pushed logic to update code minings on classpath changed event only for editors for resources from classpath source folders. Thus, pom are filtered out (27e08f9). It looks like a fair assumption for the moment. Thus, pom editors are not applicable to this code any longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: eclipse something that is specific for Eclipse theme: internal-architecture type: bug
Projects
None yet
Development

No branches or pull requests

2 participants