|Subject:||Re: [sonar-user] [sonar-runner] SonarException: Unable to read and import ... - identical filenames?|
|From:||Evgeny Mandrikov (mand...@gmail.com)|
|Date:||Mar 12, 2012 1:37:55 am|
Indeed due to chains of exceptions in Sonar it's hard to distinguish two cases :
1. source encoding problem 2. files with same name in same namespace
And in order to distinguish them - you should take a look (or provide for us) full stack-strace of error, which will contain root cause explaining problem.
On Mon, Mar 12, 2012 at 12:29, Marc Verwerft <marc...@gmail.com>wrote:
I've pursuited your reasoning and tried figuring out any differences in encoding or dos/unix style between the files and others that can be handled by sonar. I found none. Then I concluded I needed a test. So I've created 2 identical named EMPTY files in 2 directories. And I get the same error - so I think this proves it must be due to the identical filenames ...
So I don't think I can fix this with the sourceEncoding setting ... Thanks for the reply though.
On Fri, Mar 9, 2012 at 11:10 AM, Freddy Mallet <fred...@gmail.com>wrote:
By default, Sonar uses the charset of the machine used to execute the Sonar batch. To override this default charset (which seems to be necessary in your case), you should use the property 'sonar.sourceEncoding'.
Kind regards, Freddy
----- twitter.com/FreddyMallet Sonar for Continuous Inspection
On Thu, Mar 8, 2012 at 2:43 PM, Marc Verwerft <marc...@gmail.com
Just yesterday I installed SonarSource with sonar-runner and was trying to use it for C analysis with the latest C plugin (1.4).
Unfortunately, I bumped into the first hurdle: Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.sonar.api.utils.SonarException: Unable to read and import the source file : '/home/marc/projects/MyProject/srcs/LATEST/fw/tiny_mq/src/mp_transport.c' with the charset : 'UTF-8'. at org.sonar.runner.Runner.delegateExecution(Runner.java:189) at org.sonar.runner.Runner.execute(Runner.java:78) at org.sonar.runner.Main.main(Main.java:61) Caused by: org.sonar.api.utils.SonarException: Unable to read and import the source file : '/home/marc/projects/MyProject/srcs/LATEST/fw/tiny_mq/src/mp_transport.c' with the charset : 'UTF-8'. at org.sonar.api.batch.AbstractSourceImporter.parseDirs(AbstractSourceImporter.java:84) at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:69) at org.sonar.api.batch.AbstractSourceImporter.analyse(AbstractSourceImporter.java:60) at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64) ...
This seems related to an already known 'problem' albeit in the PHP plugin !!! If sonar-runner finds an identical filename under 2 different subdirectories the above exception is generated. I have: $ find . -name mp_transport.c ./fw/transport/src/mp_transport.c ./fw/tiny_mq/src/mp_transport.c
Is this a known error? Should I add comments somewhere?