102 lines
3.0 KiB
Plaintext
102 lines
3.0 KiB
Plaintext
=== is related to: S2486
|
|
|
|
=== relates to: S1148
|
|
|
|
=== on 30 Jul 2013, 16:55:25 Freddy Mallet wrote:
|
|
Is implemented by \http://jira.codehaus.org/browse/SONARJAVA-255
|
|
|
|
=== on 8 Aug 2013, 08:27:26 Dinesh Bolkensteyn wrote:
|
|
We need to know:
|
|
|
|
|
|
1) All possible logger objects: LOGGER, Logger, logger
|
|
|
|
|
|
2) All possible logging methods: log(), warn(), warning(), error(), info(), debug()
|
|
|
|
|
|
There should be at least one logging method in the block having BOTH the exception as an argument + some other argument.
|
|
|
|
=== on 8 Aug 2013, 13:55:29 Freddy Mallet wrote:
|
|
Conditions to log an issue :
|
|
|
|
* Either : The original exception is not used inside the try-catch block as a method parameter
|
|
* Or : When the original exception is used, the method call have only one parameter -> this original exception
|
|
|
|
=== on 8 Aug 2013, 16:35:00 Dinesh Bolkensteyn wrote:
|
|
I guess this will end up being too strong.
|
|
|
|
|
|
You can't do stuff like:
|
|
|
|
|
|
----
|
|
catch (IOException e) {
|
|
throw Throwables.propagate(e);
|
|
}
|
|
----
|
|
|
|
=== on 26 Aug 2013, 08:04:32 Dinesh Bolkensteyn wrote:
|
|
In fact we couldn't even do stuff like:
|
|
|
|
|
|
----
|
|
catch (RuntimeException e) {
|
|
throw e;
|
|
} catch (Exception e) {
|
|
/* ... */
|
|
}
|
|
----
|
|
|
|
This is now fixed.
|
|
|
|
|
|
Guava's use case is still not allowed for the time being.
|
|
|
|
=== on 11 Mar 2014, 06:56:32 Dinesh Bolkensteyn wrote:
|
|
Update ticket: \https://jira.codehaus.org/browse/SONARJAVA-446
|
|
|
|
=== on 23 Jun 2015, 08:24:17 Evgeny Mandrikov wrote:
|
|
\[~ann.campbell.2] I'm wondering how and why this references Cppcheck "exceptRethrowCopy" ?
|
|
|
|
=== on 23 Jun 2015, 11:50:27 Ann Campbell wrote:
|
|
\[~evgeny.mandrikov] the message for exceptRethrowCopy is "Throwing a copy of the caught exception instead of rethrowing the original exception. (since Cppcheck 1.52)"
|
|
|
|
|
|
If you're throwing a copy, you're not preserving the original.
|
|
|
|
=== on 23 Jun 2015, 13:45:38 Evgeny Mandrikov wrote:
|
|
\[~ann.campbell.2] To be precise - Cppcheck rule "exceptRethrowCopy" detects following case:
|
|
|
|
{noformat}
|
|
|
|
catch (Exception &e) {
|
|
|
|
throw e; // use of copy-constructor, use "throw;" to avoid call of copy-constructor
|
|
|
|
}
|
|
|
|
{noformat}
|
|
|
|
Looking on current examples, I'm wondering why you consider exact-copy as not preservation of original.
|
|
|
|
Also IMO motivation behind Cppcheck rule is different than description of this RSPEC. Note that {cpp} has no built-in notion of stack trace, compared to Java.
|
|
|
|
=== on 25 Jun 2015, 12:26:32 Ann Campbell wrote:
|
|
CPPCheck mapping removed
|
|
|
|
=== on 28 Sep 2015, 05:47:26 Ramsatish Jagajyothi wrote:
|
|
If java code is something like this, this violation is showing up which is false positive
|
|
|
|
|
|
throw (cause instanceof RuntimeException ?(RuntimeException)cause:
|
|
|
|
new XXXSystemException( cause, cause.getMessage(), e.getErrorCode()) );
|
|
|
|
|
|
I think this rule is not able to look into the throw params with ternary operator.
|
|
|
|
=== on 13 Oct 2015, 11:59:53 Ann Campbell wrote:
|
|
\[~ramsatish] please raise questions on the implementation of rules in individual languages on the https://groups.google.com/forum/#!forum/sonarqube[SonarQube Google group].
|
|
|