[SonarLint for Eclipse] Exception on empty files with jar extension

74 views
Skip to first unread message

Giacomo Boccardo

unread,
May 3, 2016, 4:12:51 AM5/3/16
to SonarLint

Using SonarLing for Eclipse 2.0.2 to analyse Java code in a maven multi-module project, if you configure maven-eclipse-plugin to create a linked resource:

<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<linkedResources>
<linkedResource>
<name>base-pom.xml</name>
<type>1</type>
<location>PARENT-1-PROJECT_LOC/pom.xml</location>
</linkedResource>
</linkedResources>
</configuration>
</plugin>

a linked resource is added to .project file:

<linkedResources>
<link>
  <name>base-pom.xml</name>
  <type>1</type>
  <locationURI>PARENT-1-PROJECT_LOC/pom.xml</locationURI>
</link>
<link>
  <name>base-pom.xml</name>
  <type>1</type>
<location>PARENT-1-PROJECT_LOC/pom.xml</location>
</link>
</linkedResources>

but the analysis fails with the following exception:

Error during analysis
java.lang.IllegalStateException: Fail to read file 'C:\PARENT-1-PROJECT_LOC\pom.xml' with encoding 'UTF-8'
at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileMetadata.readFile(FileMetadata.java:163)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileMetadata.readMetadata(FileMetadata.java:139)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.InputFileBuilder.create(InputFileBuilder.java:49)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileIndexer.indexFile(FileIndexer.java:74)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileIndexer.indexFiles(FileIndexer.java:69)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileIndexer.index(FileIndexer.java:57)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.SonarLintFileSystem.index(SonarLintFileSystem.java:40)
at org.sonarsource.sonarlint.core.analyzer.sensor.PhaseExecutor.execute(PhaseExecutor.java:43)
at org.sonarsource.sonarlint.core.container.analysis.AnalysisContainer.doAfterStart(AnalysisContainer.java:134)
at org.sonarsource.sonarlint.core.container.ComponentContainer.startComponents(ComponentContainer.java:125)
at org.sonarsource.sonarlint.core.container.ComponentContainer.execute(ComponentContainer.java:110)
at org.sonarsource.sonarlint.core.container.storage.StorageGlobalContainer.analyze(StorageGlobalContainer.java:129)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:151)
at org.sonarsource.sonarlint.core.ConnectedSonarLintEngineImpl.analyze(ConnectedSonarLintEngineImpl.java:140)
at org.sonarlint.eclipse.core.internal.server.Server.startAnalysis(Server.java:188)
at org.sonarlint.eclipse.core.internal.jobs.AnalyzeProjectJob$1.run(AnalyzeProjectJob.java:397)
Caused by: java.io.FileNotFoundException: \PARENT-1-PROJECT_LOC\pom.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at org.sonarsource.sonarlint.core.container.analysis.filesystem.FileMetadata.readFile(FileMetadata.java:158)
... 15 more

 

Giacomo Boccardo

unread,
May 3, 2016, 4:14:04 AM5/3/16
to SonarLint

Julien HENRY

unread,
May 9, 2016, 4:59:57 AM5/9/16
to SonarLint
Hi Giacomo,

Thanks for the detailed report. Linked resources are supposed to be supported but I will have a look at your example during next sprint. Ticket created:

++

Julien

Julien HENRY

unread,
May 19, 2016, 10:32:35 AM5/19/16
to SonarLint
Hi Giacomo,

It seems that the linked file is invalid. Are you really able to open it from Eclipse? Creating a linked file from the UI results in having an absolute path in .project so I'm not sure what you are trying to achieve is valid.

Also note that maven-eclipse-plugin use is discouraged (please try m2e).

++

Julien

Giacomo Boccardo

unread,
May 19, 2016, 5:02:49 PM5/19/16
to SonarLint
Hi Julien,
   I'm sure the file works because I use the same configuration in many projects.
If I create the resource from the UI, the configuration won't be stored in pom.xml, so it won't be versioned.
How am I supposed to replace maven-eclipse-plugin saving its configuration elsewhere in pom.xml?


Giacomo

Julien HENRY

unread,
May 20, 2016, 2:52:44 AM5/20/16
to Giacomo Boccardo, SonarLint
Hi Giacomo,

OK in this case I need more details. What is PARENT-1-PROJECT_LOC in your example? Is it the folder name of the root project? Is it a path (relative? absolute ?).

++

Julien

--
You received this message because you are subscribed to the Google Groups "SonarLint" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarlint+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarlint/5ee3286d-2cde-415b-b481-b00bd4727fbd%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages