NullPointerException: "org.eclipse.core.resources.IResource.getLocation()" is null

Hi folks

  • Operating system: MAC OS - Sonoma14.0 (23A344)
  • SonarLint plugin version: 9.1.0.81411
  • Programming language you’re coding in: Java
  • Is connected mode used: does not matter - so disconnected mode

And a thorough description of the problem / question:

Problem is simple to reproduce on my machine, but I’m not sure how to debug it. Every time when I save file, I got error:

File 'xxx/StreamLauncherController.java' excluded by 'JavaProjectConfiguratorExtension'
File 'xxx/StreamLauncherController.java' excluded by 'JavaProjectConfiguratorExtension'
Trigger: EDITOR_CHANGE
Clear markers on 0 excluded files
SonarLint processing file xxx/StreamLauncherController.java...
Error during execution of SonarLint analysis
java.lang.NullPointerException: Cannot invoke "org.eclipse.core.runtime.IPath.toOSString()" because the return value of "org.eclipse.core.resources.IResource.getLocation()" is null
at org.sonarlint.eclipse.jdt.internal.JdtUtils.resolveLibrary(JdtUtils.java:261)
at org.sonarlint.eclipse.jdt.internal.JdtUtils.processLibraryEntry(JdtUtils.java:226)
at org.sonarlint.eclipse.jdt.internal.JdtUtils.addClassPathToSonarProject(JdtUtils.java:134)
at org.sonarlint.eclipse.jdt.internal.JdtUtils.processProjectEntry(JdtUtils.java:252)
at org.sonarlint.eclipse.jdt.internal.JdtUtils.addClassPathToSonarProject(JdtUtils.java:137)
at org.sonarlint.eclipse.jdt.internal.JdtUtils.configureJavaProject(JdtUtils.java:108)
at org.sonarlint.eclipse.jdt.internal.JdtUtils.configure(JdtUtils.java:54)
at org.sonarlint.eclipse.jdt.internal.JavaProjectConfiguratorExtension.configure(JavaProjectConfiguratorExtension.java:91)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.configure(AbstractAnalyzeProjectJob.java:279)
at org.sonarlint.eclipse.core.internal.jobs.AbstractAnalyzeProjectJob.doRun(AbstractAnalyzeProjectJob.java:152)
at org.sonarlint.eclipse.core.internal.jobs.AbstractSonarJob.run(AbstractSonarJob.java:37)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Any idea how to find what can cause it would be appreciated.
Thanks,
D.

Hi @Dalibor_Skrobak,

thank you for raising this issue. This is a tricky one as it comes from the JDT-specific sub-plugin we have in order to create the necessary properties for the analysis of Java files.

What does your .classpath file look like? The error at this specific location seems to be coming from an incorrect classpath entry to some form of library (main or test sources). Would it be possible to share it with me for further investigation?

Best,
Tobias

Hi @Dalibor_Skrobak,

we fixed the issue you are facing with THIS ticket. It will be part of the upcoming release of SonarLint in Eclipse.

I’m still interested in your classpath file as I hope that it can be used (of course changed from your personal data) for creating a test on our side.

Best,
Tobias

1 Like