SonarQube: 7.7 Remove the redundant '!unknownSymbol!' thrown exception declaration(s)

versions used

  • SonarQube 7.7 (but same issue occured with version 6.9 and following)
  • Scanner 3.3

error observed

Remove the redundant '!unknownSymbol!' thrown exception declaration(s).

steps to reproduce

For some reasons the code have methods which throws multiple checked exceptions.
The problem is that it seems that the scanner is a bit lost when parsing it.

Here is an example of code which generates the problem:

Stream<Event> fetch() throws FetchException, NotAuthenticatedException;

All theses two exceptions extends Exception. They are declared in implemented interface. Nothing who justify the “unknownSymbol”.

My assumptions are: the scanner get lost somehow -> read an unknownSymbol and then is not able to determine with accuracy if the rule should succeed or not.

Any help is welcome thank you in advance

potential workaround
I have to mark manually as wrong positive…

hello @svermeille,

indeed this is a false positive. I created ticket to fix it . While this will avoid raising of the issue, it might be also interesting to understand why the exception types are not resolved properly. Were all the dependencies provided to the analyzer? What kind of scanner (maven, gradle, …) do you use?

1 Like

Hello @saberduck,

I use the standalone scanner delivered by sonar version 3.3

Regarding the question about dependencies.
This is a maven project everything is located in target/ dir do I have to explicitely says to sonar go read target/libs/*.jar folder ?

Maybe you pointed the mistake

No, with maven scanner everything should be automatic, you don’t need to configure any properties unless there is something peculiar about the way you build your project.

@saberduck thank you for the explainations.

I see that the ticket you created is marked as closed + fixed but for sonarjava plugin version 5.13 ! Great news :slight_smile:

Do you know moreless the release date for this new plugin version ? can I already deploy it perhaps manually ?

Release will happen within few days. You can download the binary on this url

1 Like

Great thank you very much :slight_smile: