|
Hi,
yesterday I upgraded to SONAR 3.3 (from 3.0) and C#-Ecosystem plugin from 1.3 to 1.4. The nightly build failed because I also introduced the SCM activity plugin but I managed to get around this already. Now I am facing a problem with encoding I think, maybe someone can shed a light... We use Sonar on a C#-Solution with VS2010 and Clearcase as SCM tool. Visual studio saves all files as UTF8 by default. Clearcase sometimes has problems with this, so some files in our solution were changed to Codepage 1252 by hand, but most are not. Now, when running the new Sonar 3.3, I get tons of warnings and errors complaining about wrong encoding: 09:19:56 09:19:56.296 WARN nownCharacterChannel - Unknown char: "»" (file:/C:/Snapshots/NightlyDebug/contest_sw/CommonTypes/CommonTypes/Carrier.cs:1:2) 09:19:56 09:19:56.296 WARN nownCharacterChannel - Unknown char: "¿" (file:/C:/Snapshots/NightlyDebug/contest_sw/CommonTypes/CommonTypes/Carrier.cs:1:3) 09:19:56 09:19:56.330 ERROR c.s.s.s.AstScanner - Unable to parse source file : C:\Snapshots\NightlyDebug\contest_sw\CommonTypes\CommonTypes\Carrier.cs 09:19:56 09:19:56.330 WARN nownCharacterChannel - Unknown char: "»" (file:/C:/Snapshots/NightlyDebug/contest_sw/CommonTypes/CommonTypes/Carrier.cs:1:2) 09:19:56 09:19:56.330 WARN nownCharacterChannel - Unknown char: "¿" (file:/C:/Snapshots/NightlyDebug/contest_sw/CommonTypes/CommonTypes/Carrier.cs:1:3) 09:19:56 09:19:56.360 ERROR c.s.s.s.AstScanner - Source Snippet: 09:19:56 --------------- 09:19:56 -->  09:19:56 2 09:19:56 3 09:19:56 4 09:19:56 5 09:19:56 6 09:19:56 7 09:19:56 8 09:19:56 9 09:19:56 10 09:19:56 11 09:19:56 12 09:19:56 13 09:19:56 14 09:19:56 15 09:19:56 16 09:19:56 17 09:19:56 18 09:19:56 19 09:19:56 20 namespace x.y.CommonTypes 09:19:56 21 { 09:19:56 22 09:19:56 23 using System; 09:19:56 24 using System.Text; 09:19:56 25 09:19:56 26 09:19:56 27 09:19:56 28 09:19:56 29 09:19:56 30 public class Carrier : ICloneable, IEquatable<Carrier> 09:19:56 31 { 09:19:56 32 09:19:56 33 09:19:56 34 09:19:56 35 09:19:56 36 private Frequency centerFrequency 09:19:56 --------------- 09:19:56 09:19:56 on matcher compilationUnit.is(and(opt(one2n(externAliasDirective)), opt(one2n(usingDirective)), opt(globalAttributes), opt(one2n(namespaceMemberDeclaration)), EOF)) 09:19:56 1 : 0 : EXTERN expected but "ï" [IDENTIFIER] found 09:19:56 at externAliasDirective 09:19:56 1 : 0 : 09:19:56 at compilationUnit 09:19:56 1 : 0 : 09:19:56 09:19:56 Last successful tokens: 09:19:56 ----------------------- I checked for some files in this project: Those with UTF8 encoding fail, those with Codepage 1252 can be parsed. In the end the parsing of the Gendarme XML file fails with an encoding error, too. 09:20:27 09:20:27.919 INFO .u.c.CommandExecutor - Executing command: c:\Program Files (x86)\Gendarme\gendarme.exe --config C:\Snapshots\NightlyDebug\contest_sw\CommonTypes\CommonTypes\.sonar\sonar.Gendarme --xml C:\Snapshots\NightlyDebug\contest_sw\CommonTypes\CommonTypes\.sonar\gendarme-report.xml --quiet --confidence normal+ --severity all c:\Snapshots\NightlyDebug\contest_sw\CommonTypes\CommonTypes\..\..\Bin\Debug\x.y.CommonTypes.dll 09:20:46 Total time: 6:31.640s 09:20:46 Final Memory: 13M/228M 09:20:46 Exception in thread "main" org.sonar.runner.RunnerException: org.sonar.api.utils.SonarException: Error while reading Gendarme result file: C:\Snapshots\NightlyDebug\contest_sw\CommonTypes\CommonTypes\.sonar\gendarme-report.xml 09:20:46 at org.sonar.runner.Runner.delegateExecution(Runner.java:288) 09:20:46 at org.sonar.runner.Runner.execute(Runner.java:151) 09:20:46 at org.sonar.runner.Main.execute(Main.java:84) 09:20:46 at org.sonar.runner.Main.main(Main.java:56) 09:20:46 Caused by: org.sonar.api.utils.SonarException: Error while reading Gendarme result file: C:\Snapshots\NightlyDebug\contest_sw\CommonTypes\CommonTypes\.sonar\gendarme-report.xml 09:20:46 at org.sonar.plugins.csharp.gendarme.results.GendarmeResultParser.parse(GendarmeResultParser.java:100) 09:20:46 at org.sonar.plugins.csharp.gendarme.GendarmeSensor.analyseResults(GendarmeSensor.java:189) 09:20:46 at org.sonar.plugins.csharp.gendarme.GendarmeSensor.analyse(GendarmeSensor.java:142) 09:20:46 at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:64) 09:20:46 at org.sonar.batch.phases.Phases.execute(Phases.java:97) 09:20:46 at org.sonar.batch.bootstrap.ProjectModule.doStart(ProjectModule.java:128) 09:20:46 at org.sonar.batch.bootstrap.Module.start(Module.java:83) 09:20:46 at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:114) 09:20:46 at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:109) 09:20:46 at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:104) 09:20:46 at org.sonar.batch.bootstrap.Module.start(Module.java:83) 09:20:46 at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121) 09:20:46 at org.sonar.batch.bootstrap.Module.start(Module.java:83) 09:20:46 at org.sonar.batch.Batch.execute(Batch.java:104) 09:20:46 at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:69) 09:20:46 at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61) 09:20:46 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 09:20:46 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 09:20:46 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 09:20:46 at java.lang.reflect.Method.invoke(Method.java:597) 09:20:46 at org.sonar.runner.Runner.delegateExecution(Runner.java:285) 09:20:46 ... 3 more 09:20:46 Caused by: com.ctc.wstx.exc.WstxIOException: Unexpected first character (char code 0xEF), not valid in xml document: could be mangled UTF-8 BOM marker. Make sure that the Reader uses correct encoding or pass an InputStream instead 09:20:46 at com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:174) 09:20:46 at com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:531) 09:20:46 at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:585) 09:20:46 at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:641) 09:20:46 at com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:323) 09:20:46 at org.codehaus.staxmate.SMInputFactory.createStax2Reader(SMInputFactory.java:234) 09:20:46 at org.codehaus.staxmate.SMInputFactory.rootElementCursor(SMInputFactory.java:337) 09:20:46 at org.sonar.plugins.csharp.gendarme.results.GendarmeResultParser.parse(GendarmeResultParser.java:95) 09:20:46 ... 23 more 09:20:46 Build step 'Execute Windows batch command' marked build as failure What can I do? Change all our files to Codepage 1252 (which would be hard to achieve taking into account that new files will be again UTF8)? BR Dirk -- Never trust a short-haired guru --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi Dirk, Clearly, "" is the UTF-8 BOM character. Visual Studio indeed by default saves files in UTF-8, with the leading BOM character. When you analyze your project with Sonar, you must specify a single encoding that will be used for all the files in your project/module.
It seems, from what you are saying, that in your project/module, *some* files are encoded in UTF-8, and *some* in Codepage 1252. Currently, you cannot analyze a project/module with inconsistent (i.e. several) encoding. You'll need to either have all your files in UTF-8, or in Codepage 1252. On Fri, Oct 26, 2012 at 9:59 AM, Dirk Kuypers <[hidden email]> wrote: Hi, |
|
In reply to this post by Dirk Kuypers-2
Hi Dirk,
just for information: which runner are you using to launch Sonar analyses? Maven or Sonar Runner? If you using Sonar Runner and if you recently updated from Sonar Runner 1.4 to Sonar Runner 2.0, the ticket SONARPLUGINS-2256 could explain your problem: now, the Sonar Runner (since 2.0) does not specify UTF-8 as the default encoding, it's up to the project to set it in its config file.
Best regards,
On Fri, Oct 26, 2012 at 9:59 AM, Dirk Kuypers <[hidden email]> wrote: Hi, |
|
Ah! I forgot to mention this: I also upgraded the sonar-runner to 2.0.
I'll give my old version (I think it was 1.2) a shot. BR Dirk
2012/10/26 Fabrice Bellingard <[hidden email]> Hi Dirk, |
|
Hi again,
reverting to sonar-runner 1.2 helped, Sonar runs longer. So I guess I have to set the default encoding to UTF8 now with newer versions of sonar-runner. But now I am bitten by a directory name: R&TTE (note the ampersand...)
Any more hints? Ist this a change in C# plugin 1.4 vs. 1.3?!? BR and thanks so far Dirk 11:10:26 11:10:26.877 INFO .u.c.CommandExecutor - Writing report to C:\Snapshots\NightlyDebug\contest_sw\Applications\x\y\z\.sonar\fxcop-report.xml... 11:10:26 11:10:26.879 INFO .u.c.CommandExecutor - Done:00:00:05.5975597 11:10:27 11:10:27.597 INFO p.PhasesTimeProfiler - Sensor org.sonar.plugins.csharp.fxcop.FxCopSensor$RegularFxCopSensor@671474e9 done: 6426 ms11:10:28 11:10:28.057 INFO p.PhasesTimeProfiler - Execute decorators...11:10:40 Total time: 15:12.372s 11:10:40 Final Memory: 14M/320M 11:10:40 Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.sonar.api.utils.SonarException: Fail to decorate 'org.sonar.api.resources.File@55a34df8[key=Aclr/R&TTE/file.cs,dir=Aclr/R&TTE,filename=file.cs,language=C#]' 2012/10/26 Dirk Kuypers <[hidden email]> Ah! I forgot to mention this: I also upgraded the sonar-runner to 2.0. |
|
On Fri, Oct 26, 2012 at 11:24 AM, Dirk Kuypers <[hidden email]> wrote:
Hi again, Yes, definitely! And actually, we removed this default value because we consider that this is a good practice that projects set the source encoding themselves.
Actually, you hit this bug: http://jira.codehaus.org/browse/SONAR-3903
We've just fixed it for Sonar 3.4, but considering that you're also facing it, we may apply this fix in the upcoming 3.3.1 release planned for next week.
|
|
In reply to this post by Dirk Kuypers-2
Hi Fabrice,
thanks for your prompt reactions! 2012/10/26 Fabrice Bellingard <[hidden email]> > On Fri, Oct 26, 2012 at 11:24 AM, Dirk Kuypers <[hidden email]>wrote: > >> Hi again, >> >> reverting to sonar-runner 1.2 helped, Sonar runs longer. So I guess I >> have to set the default encoding to UTF8 now with newer versions of >> sonar-runner. >> > > Yes, definitely! And actually, we removed this default value because we > consider that this is a good practice that projects set the source encoding > themselves > ok, I am back to 2.0 and have set the default encoding. > But now I am bitten by a directory name: R&TTE (note the ampersand...) >> >> Any more hints? Ist this a change in C# plugin 1.4 vs. 1.3?!? >> > > Actually, you hit this bug: http://jira.codehaus.org/browse/SONAR-3903 > > We've just fixed it for Sonar 3.4, but considering that you're also facing > it, we may apply this fix in the upcoming 3.3.1 release planned for next > week. > Would be great! What is the ETA next week?;-) Thanks Dirk -- Never trust a short-haired guru --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Fri, Oct 26, 2012 at 11:47 AM, Dirk Kuypers <[hidden email]> wrote:
Don't know yet, depends on if other bugs are discovered ;-)
|
|
2012/10/26 Fabrice Bellingard <[hidden email]>:
> On Fri, Oct 26, 2012 at 11:47 AM, Dirk Kuypers <[hidden email]> > wrote: >> >> >> > We've just fixed it for Sonar 3.4, but considering that you're also >> > facing >> > it, we may apply this fix in the upcoming 3.3.1 release planned for next >> > week. >> > >> >> Would be great! What is the ETA next week? ;-) > > > Don't know yet, depends on if other bugs are discovered ;-) Is it possible to downgrade to Sonar 3.2.1? Dirk -- Never trust a short-haired guru --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Fri, Oct 26, 2012 at 1:20 PM, Dirk Kuypers <[hidden email]> wrote:
Well, this bug is not a regression introduced in Sonar 3.3, so downgrading wouldn't help. You probably faced this bug because some new duplications have been found in the file which path contains '&'. Can you confirm?
|
|
In reply to this post by Dirk Kuypers-2
> Well, this bug is not a regression introduced in Sonar 3.3, so downgrading
> wouldn't help. You probably faced this bug because some new duplications > have been found in the file which path contains '&'. Can you confirm? Hm, no. The file was changed on 11th October, and did not cause problems with Sonar 3.0 I used before. Or is this caused by a plugin I updated? Dirk -- Never trust a short-haired guru --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
On Fri, Oct 26, 2012 at 2:09 PM, Dirk Kuypers <[hidden email]> wrote:
The Useless Code Tracker plugin for instance?
|
|
Downgrading to Useless Code Tracker plugin to 0.4 leads to another error:
14:34:52 Exception in thread "main" org.sonar.runner.RunnerException: java.lang.NoClassDefFoundError: org/sonar/duplications/cpd/CPD 14:34:52 at org.sonar.runner.Runner.delegateExecution(Runner.java:288) 14:34:52 at org.sonar.runner.Runner.execute(Runner.java:151) 14:34:52 at org.sonar.runner.Main.execute(Main.java:84) 14:34:52 at org.sonar.runner.Main.main(Main.java:56) 14:34:52 Caused by: java.lang.NoClassDefFoundError: org/sonar/duplications/cpd/CPD 14:34:52 at java.lang.Class.getDeclaredMethods0(Native Method) 14:34:52 at java.lang.Class.privateGetDeclaredMethods(Class.java:2427) 14:34:52 at java.lang.Class.getDeclaredMethods(Class.java:1791) 14:34:52 at org.picocontainer.injectors.AdaptingInjection$1.run(AdaptingInjection.java:203) 14:34:52 at java.security.AccessController.doPrivileged(Native Method) 14:34:52 at org.picocontainer.injectors.AdaptingInjection.injectionMethodAnnotated(AdaptingInjection.java:200) 14:34:52 at org.picocontainer.injectors.AdaptingInjection.methodAnnotatedInjectionAdapter(AdaptingInjection.java:171) 14:34:52 at org.picocontainer.injectors.AdaptingInjection.createComponentAdapter(AdaptingInjection.java:70) 14:34:52 at org.picocontainer.behaviors.AbstractBehaviorFactory.createComponentAdapter(AbstractBehaviorFactory.java:44) 14:34:52 at org.picocontainer.behaviors.OptInCaching.createComponentAdapter(OptInCaching.java:45) 14:34:52 at org.picocontainer.DefaultPicoContainer.addComponent(DefaultPicoContainer.java:536) 14:34:52 at org.picocontainer.DefaultPicoContainer.access$300(DefaultPicoContainer.java:80) 14:34:52 at org.picocontainer.DefaultPicoContainer$AsPropertiesPicoContainer.addComponent(DefaultPicoContainer.java:1142) 14:34:52 at org.sonar.api.platform.ComponentContainer.addComponent(ComponentContainer.java:92) 14:34:52 at org.sonar.api.platform.ComponentContainer.addSingleton(ComponentContainer.java:84) 14:34:52 at org.sonar.batch.bootstrap.Module.addCoreSingleton(Module.java:115) 14:34:52 at org.sonar.batch.bootstrap.ProjectExtensionInstaller.installExtension(ProjectExtensionInstaller.java:86) 14:34:52 at org.sonar.batch.bootstrap.ProjectExtensionInstaller.install(ProjectExtensionInstaller.java:59) 14:34:52 at org.sonar.batch.bootstrap.ProjectModule.addProjectPluginExtensions(ProjectModule.java:108) 14:34:52 at org.sonar.batch.bootstrap.ProjectModule.configure(ProjectModule.java:58) 14:34:52 at org.sonar.batch.bootstrap.Module.init(Module.java:49) 14:34:52 at org.sonar.batch.bootstrap.Module.installChild(Module.java:70) 14:34:52 at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:112) 14:34:52 at org.sonar.batch.bootstrap.BatchModule.analyze(BatchModule.java:109) 14:34:52 at org.sonar.batch.bootstrap.BatchModule.doStart(BatchModule.java:104) 14:34:52 at org.sonar.batch.bootstrap.Module.start(Module.java:83) 14:34:52 at org.sonar.batch.bootstrap.BootstrapModule.doStart(BootstrapModule.java:121) 14:34:52 at org.sonar.batch.bootstrap.Module.start(Module.java:83) 14:34:52 at org.sonar.batch.Batch.execute(Batch.java:104) 14:34:52 at org.sonar.runner.internal.batch.Launcher.executeBatch(Launcher.java:69) 14:34:52 at org.sonar.runner.internal.batch.Launcher.execute(Launcher.java:61) 14:34:52 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 14:34:52 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 14:34:52 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 14:34:52 at java.lang.reflect.Method.invoke(Method.java:597) 14:34:52 at org.sonar.runner.Runner.delegateExecution(Runner.java:285) 14:34:52 ... 3 more 14:34:52 Caused by: java.lang.ClassNotFoundException: org.sonar.duplications.cpd.CPD 14:34:52 at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) 14:34:52 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244) 14:34:52 at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230) 14:34:52 ... 39 more So I think I have to wait for Sonar 3.3.1. Dirk 2012/10/26 Fabrice Bellingard <[hidden email]>: > On Fri, Oct 26, 2012 at 2:09 PM, Dirk Kuypers <[hidden email]> > wrote: >> >> > Well, this bug is not a regression introduced in Sonar 3.3, so >> > downgrading >> > wouldn't help. You probably faced this bug because some new duplications >> > have been found in the file which path contains '&'. Can you confirm? >> >> Hm, no. The file was changed on 11th October, and did not cause >> problems with Sonar 3.0 I used before. Or is this caused by a plugin I >> updated? > > > The Useless Code Tracker plugin for instance? > >> >> >> Dirk >> >> -- >> Never trust a short-haired guru >> >> --------------------------------------------------------------------- >> To unsubscribe from this list, please visit: >> >> http://xircles.codehaus.org/manage_email >> >> > -- Never trust a short-haired guru --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Hi,
when I was cycling home on Friday evening I just had another idea: removing the useless code tracker plugin. This worked! So I am able to analyse my project again, no hurry for 3.3.1 anymore.;-) BR Dirk --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
Indeed, that's the fastest and easiest way :)
Best regards,
On Mon, Oct 29, 2012 at 11:00 AM, Dirk Kuypers <[hidden email]> wrote: Hi, |
| Powered by Nabble | Edit this page |
