[sonar-dev] Sonar Plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[sonar-dev] Sonar Plugin

Franco Rossi
Hi,

I am upgrading a plugin for sonarqube from 4.3.2 to 4.5.1, but apparently I am having problems loading my rules. After depoying my plugin the server crashes and I get the following exception:

org.sonar.server.platform.PlatformServletContextListener
org.sonar.server.exceptions.BadRequestException: Rule not found: coverity-cpp:STATIC_C_SWAPPED_ARGUMENTS_none
    at org.sonar.server.qualityprofile.RuleActivatorContextFactory.initRule(RuleActivatorContextFactory.java:80) ~[sonar-server-4.5.1.jar:na]

It seems that rules are being loaded to my profile, but they are not found in a certain sql session.

What really confuse me is the fact that my plugin works for 4.3.2 and not for 4.5.1 despite the fact that the xoo-plugin example that is shipped with sonarqube is the same for both versions.

Currently I am overriding the "define()" method from "RulesDefinition" so it uses an xmlLoader to load the rules in my repo. Then I override "createProfile()" from "ProfileDefinition" so it creates a profile and activates my rules (as it is done on xoo-plugin).

Could you please tell me how should I fix this issue?

Franco Rossi,
Software Engineer,
Coverity Inc.


Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] Sonar Plugin

Simon Brandhof
Hi Franco,

Does this error occur in the master branch of https://github.com/coverity/coverity-sonar-plugin so we can try to reproduce it ?

Regards 


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 15 December 2014 at 21:26, Franco Rossi <[hidden email]> wrote:
Hi,

I am upgrading a plugin for sonarqube from 4.3.2 to 4.5.1, but apparently I am having problems loading my rules. After depoying my plugin the server crashes and I get the following exception:

org.sonar.server.platform.PlatformServletContextListener
org.sonar.server.exceptions.BadRequestException: Rule not found: coverity-cpp:STATIC_C_SWAPPED_ARGUMENTS_none
    at org.sonar.server.qualityprofile.RuleActivatorContextFactory.initRule(RuleActivatorContextFactory.java:80) ~[sonar-server-4.5.1.jar:na]

It seems that rules are being loaded to my profile, but they are not found in a certain sql session.

What really confuse me is the fact that my plugin works for 4.3.2 and not for 4.5.1 despite the fact that the xoo-plugin example that is shipped with sonarqube is the same for both versions.

Currently I am overriding the "define()" method from "RulesDefinition" so it uses an xmlLoader to load the rules in my repo. Then I override "createProfile()" from "ProfileDefinition" so it creates a profile and activates my rules (as it is done on xoo-plugin).

Could you please tell me how should I fix this issue?

Franco Rossi,
Software Engineer,
Coverity Inc.


Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] Sonar Plugin

Franco Rossi

Hi Simon,


Yes, you can reproduce the error using that branch.


I think I've found the cause of the problem. On line 100 of RegisterRules sonarqube checks whether the language of a repo is on a languages list. By default, cpp and c# are not there, but they are included if you add the corresponding jar files (these are the jar files that you use to add sonar profiles for those languages even when you are not using our plugin). In previous releases you where allowed to load profiles for all languages but they might not work if you don't add those jar files. Now on the other hand if those jar files are not there the server crashes. 


How can I add more languages to that list without adding those jar files?


- Franco.​


From: Simon Brandhof <[hidden email]>
Sent: Tuesday, December 16, 2014 12:23 AM
To: PUBLIC Codehaus Dev
Subject: Re: [sonar-dev] Sonar Plugin
 
Hi Franco,

Does this error occur in the master branch of https://github.com/coverity/coverity-sonar-plugin so we can try to reproduce it ?

Regards 


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 15 December 2014 at 21:26, Franco Rossi <[hidden email]> wrote:
Hi,

I am upgrading a plugin for sonarqube from 4.3.2 to 4.5.1, but apparently I am having problems loading my rules. After depoying my plugin the server crashes and I get the following exception:

org.sonar.server.platform.PlatformServletContextListener
org.sonar.server.exceptions.BadRequestException: Rule not found: coverity-cpp:STATIC_C_SWAPPED_ARGUMENTS_none
    at org.sonar.server.qualityprofile.RuleActivatorContextFactory.initRule(RuleActivatorContextFactory.java:80) ~[sonar-server-4.5.1.jar:na]

It seems that rules are being loaded to my profile, but they are not found in a certain sql session.

What really confuse me is the fact that my plugin works for 4.3.2 and not for 4.5.1 despite the fact that the xoo-plugin example that is shipped with sonarqube is the same for both versions.

Currently I am overriding the "define()" method from "RulesDefinition" so it uses an xmlLoader to load the rules in my repo. Then I override "createProfile()" from "ProfileDefinition" so it creates a profile and activates my rules (as it is done on xoo-plugin).

Could you please tell me how should I fix this issue?

Franco Rossi,
Software Engineer,
Coverity Inc.


Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] Sonar Plugin

Simon Brandhof
Hi Franco,

The bug was reproduced and fixed in version 5.1 (see http://jira.codehaus.org/browse/SONAR-5972). I can't tell you yet if it will be backported to 4.5.2 and 5.0.

Thanks for the feedback.
Simon


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 16 December 2014 at 21:44, Franco Rossi <[hidden email]> wrote:

Hi Simon,


Yes, you can reproduce the error using that branch.


I think I've found the cause of the problem. On line 100 of RegisterRules sonarqube checks whether the language of a repo is on a languages list. By default, cpp and c# are not there, but they are included if you add the corresponding jar files (these are the jar files that you use to add sonar profiles for those languages even when you are not using our plugin). In previous releases you where allowed to load profiles for all languages but they might not work if you don't add those jar files. Now on the other hand if those jar files are not there the server crashes. 


How can I add more languages to that list without adding those jar files?


- Franco.​


From: Simon Brandhof <[hidden email]>
Sent: Tuesday, December 16, 2014 12:23 AM
To: PUBLIC Codehaus Dev
Subject: Re: [sonar-dev] Sonar Plugin
 
Hi Franco,

Does this error occur in the master branch of https://github.com/coverity/coverity-sonar-plugin so we can try to reproduce it ?

Regards 


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 15 December 2014 at 21:26, Franco Rossi <[hidden email]> wrote:
Hi,

I am upgrading a plugin for sonarqube from 4.3.2 to 4.5.1, but apparently I am having problems loading my rules. After depoying my plugin the server crashes and I get the following exception:

org.sonar.server.platform.PlatformServletContextListener
org.sonar.server.exceptions.BadRequestException: Rule not found: coverity-cpp:STATIC_C_SWAPPED_ARGUMENTS_none
    at org.sonar.server.qualityprofile.RuleActivatorContextFactory.initRule(RuleActivatorContextFactory.java:80) ~[sonar-server-4.5.1.jar:na]

It seems that rules are being loaded to my profile, but they are not found in a certain sql session.

What really confuse me is the fact that my plugin works for 4.3.2 and not for 4.5.1 despite the fact that the xoo-plugin example that is shipped with sonarqube is the same for both versions.

Currently I am overriding the "define()" method from "RulesDefinition" so it uses an xmlLoader to load the rules in my repo. Then I override "createProfile()" from "ProfileDefinition" so it creates a profile and activates my rules (as it is done on xoo-plugin).

Could you please tell me how should I fix this issue?

Franco Rossi,
Software Engineer,
Coverity Inc.


Reply | Threaded
Open this post in threaded view
|

Re: [sonar-dev] Sonar Plugin

Franco Rossi

Hi,


I was able to fix the problem by defining classes (for the missing languages) that extend AbstractLanguage. Like the class "Java.java" in 4.5.1.


Thank you,

- Franco.



From: Simon Brandhof <[hidden email]>
Sent: Friday, December 19, 2014 12:33 PM
To: PUBLIC Codehaus Dev
Subject: Re: [sonar-dev] Sonar Plugin
 
Hi Franco,

The bug was reproduced and fixed in version 5.1 (see http://jira.codehaus.org/browse/SONAR-5972). I can't tell you yet if it will be backported to 4.5.2 and 5.0.

Thanks for the feedback.
Simon


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 16 December 2014 at 21:44, Franco Rossi <[hidden email]> wrote:

Hi Simon,


Yes, you can reproduce the error using that branch.


I think I've found the cause of the problem. On line 100 of RegisterRules sonarqube checks whether the language of a repo is on a languages list. By default, cpp and c# are not there, but they are included if you add the corresponding jar files (these are the jar files that you use to add sonar profiles for those languages even when you are not using our plugin). In previous releases you where allowed to load profiles for all languages but they might not work if you don't add those jar files. Now on the other hand if those jar files are not there the server crashes. 


How can I add more languages to that list without adding those jar files?


- Franco.​


From: Simon Brandhof <[hidden email]>
Sent: Tuesday, December 16, 2014 12:23 AM
To: PUBLIC Codehaus Dev
Subject: Re: [sonar-dev] Sonar Plugin
 
Hi Franco,

Does this error occur in the master branch of https://github.com/coverity/coverity-sonar-plugin so we can try to reproduce it ?

Regards 


Simon BRANDHOF | SonarSource
http://twitter.com/SimonBrandhof

On 15 December 2014 at 21:26, Franco Rossi <[hidden email]> wrote:
Hi,

I am upgrading a plugin for sonarqube from 4.3.2 to 4.5.1, but apparently I am having problems loading my rules. After depoying my plugin the server crashes and I get the following exception:

org.sonar.server.platform.PlatformServletContextListener
org.sonar.server.exceptions.BadRequestException: Rule not found: coverity-cpp:STATIC_C_SWAPPED_ARGUMENTS_none
    at org.sonar.server.qualityprofile.RuleActivatorContextFactory.initRule(RuleActivatorContextFactory.java:80) ~[sonar-server-4.5.1.jar:na]

It seems that rules are being loaded to my profile, but they are not found in a certain sql session.

What really confuse me is the fact that my plugin works for 4.3.2 and not for 4.5.1 despite the fact that the xoo-plugin example that is shipped with sonarqube is the same for both versions.

Currently I am overriding the "define()" method from "RulesDefinition" so it uses an xmlLoader to load the rules in my repo. Then I override "createProfile()" from "ProfileDefinition" so it creates a profile and activates my rules (as it is done on xoo-plugin).

Could you please tell me how should I fix this issue?

Franco Rossi,
Software Engineer,
Coverity Inc.