Fix exception wrapping to retain original message #1175
pmd.yml
on: pull_request
PMD Static Code Analysis
34s
Annotations
10 errors and 10 warnings
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/ClientOptions.java#L175
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/ClientOptions.java#L159
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/ClientOptions.java#L158
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/Client.java#L228
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/Client.java#L206
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/Client.java#L201
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/Client.java#L165
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/Client.java#L160
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/Client.java#L88
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
Logger calls should be surrounded by log level guards.:
common/client/src/main/java/zingg/common/client/Client.java#L82
Whenever using a log level, one should check if it is actually enabled, or
otherwise skip the associate String creation and manipulation, as well as any method calls.
An alternative to checking the log level are substituting parameters, formatters or lazy logging
with lambdas. The available alternatives depend on the actual logging framework.
GuardLogStatement (Priority: 2, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#guardlogstatement
|
|
This call to Collection.toArray() may be optimizable:
common/client/src/main/java/zingg/common/client/ClientOptions.java#L92
Calls to a collection's `toArray(E[])` method should specify a target array of zero size. This allows the JVM
to optimize the memory allocation and copying as much as possible.
Previous versions of this rule (pre PMD 6.0.0) suggested the opposite, but current JVM implementations
perform always better, when they have full control over the target array. And allocation an array via
reflection is nowadays as fast as the direct allocation.
See also [Arrays of Wisdom of the Ancients](https://shipilev.net/blog/2016/arrays-wisdom-ancients/)
Note: If you don't need an array of the correct type, then the simple `toArray()` method without an array
is faster, but returns only an array of type `Object[]`.
OptimizableToArrayCall (Priority: 3, Ruleset: Performance)
https://docs.pmd-code.org/snapshot/pmd_rules_java_performance.html#optimizabletoarraycall
|
|
Logger should be defined private static final and have the correct class:
common/client/src/main/java/zingg/common/client/ClientOptions.java#L42
A logger should normally be defined private static final and be associated with the correct class.
`private final Log log;` is also allowed for rare cases where loggers need to be passed around,
with the restriction that the logger needs to be passed into the constructor.
ProperLogger (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#properlogger
|
|
This statement should have braces:
common/client/src/main/java/zingg/common/client/Client.java#L265
Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... else'
statements and loop statements, even if they are optional. This usually makes the code clearer, and
helps prepare the future when you need to add another statement. That said, this rule lets you control
which statements are required to have braces via properties.
From 6.2.0 on, this rule supersedes WhileLoopMustUseBraces, ForLoopMustUseBraces, IfStmtMustUseBraces,
and IfElseStmtMustUseBraces.
ControlStatementBraces (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#controlstatementbraces
|
|
This statement should have braces:
common/client/src/main/java/zingg/common/client/Client.java#L230
Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... else'
statements and loop statements, even if they are optional. This usually makes the code clearer, and
helps prepare the future when you need to add another statement. That said, this rule lets you control
which statements are required to have braces via properties.
From 6.2.0 on, this rule supersedes WhileLoopMustUseBraces, ForLoopMustUseBraces, IfStmtMustUseBraces,
and IfElseStmtMustUseBraces.
ControlStatementBraces (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#controlstatementbraces
|
|
A catch statement should never catch throwable since it includes errors.:
common/client/src/main/java/zingg/common/client/Client.java#L220
Catching Throwable errors is not recommended since its scope is very broad. It includes runtime issues such as
OutOfMemoryError that should be exposed and managed separately.
**Deprecated:** This rule is deprecated since PMD 7.18.0 and will be removed with PMD 8.0.0.
This rule has been subsumed by {% rule AvoidCatchingGenericException %},
which is now configurable as to which exceptions cause a violation.
AvoidCatchingThrowable (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#avoidcatchingthrowable
|
|
This statement should have braces:
common/client/src/main/java/zingg/common/client/Client.java#L201
Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... else'
statements and loop statements, even if they are optional. This usually makes the code clearer, and
helps prepare the future when you need to add another statement. That said, this rule lets you control
which statements are required to have braces via properties.
From 6.2.0 on, this rule supersedes WhileLoopMustUseBraces, ForLoopMustUseBraces, IfStmtMustUseBraces,
and IfElseStmtMustUseBraces.
ControlStatementBraces (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#controlstatementbraces
|
|
Useless parentheses around `args`.:
common/client/src/main/java/zingg/common/client/Client.java#L120
Parenthesized expressions are used to override the default operator precedence
rules. Parentheses whose removal would not change the relative nesting of operators
are unnecessary, because they don't change the semantics of the enclosing expression.
Some parentheses that strictly speaking are unnecessary, may still be considered useful
for readability. This rule allows to ignore violations on two kinds of unnecessary parentheses:
- "Clarifying" parentheses, which separate operators of difference precedence. While
unnecessary, they make precedence rules explicit, which may be useful for rarely used
operators. For example:
```java
(a + b) & c // is equivalent to `a + b & c`, but probably clearer
```
Unset the property `ignoreClarifying` to report them.
- "Balancing" parentheses, which are unnecessary but visually balance out another pair
of parentheses around an equality operator. For example, those two expressions are equivalent:
```java
(a == null) != (b == null)
a == null != (b == null)
```
The parentheses on the right are required, and the parentheses on the left are
just more visually pleasing. Unset the property `ignoreBalancing` to report them.
UselessParentheses (Priority: 4, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#uselessparentheses
|
|
Do not use `new Long(...)`, prefer `Long.valueOf(...)`:
common/client/src/main/java/zingg/common/client/Client.java#L112
Reports usages of primitive wrapper constructors. They are deprecated
since Java 9 and should not be used. Even before Java 9, they can
be replaced with usage of the corresponding static `valueOf` factory method
(which may be automatically inserted by the compiler since Java 1.5).
This has the advantage that it may reuse common instances instead of creating
a new instance each time.
Note that for `Boolean`, the named constants `Boolean.TRUE` and `Boolean.FALSE`
are preferred instead of `Boolean.valueOf`.
PrimitiveWrapperInstantiation (Priority: 3, Ruleset: Best Practices)
https://docs.pmd-code.org/snapshot/pmd_rules_java_bestpractices.html#primitivewrapperinstantiation
|
|
This statement should have braces:
common/client/src/main/java/zingg/common/client/Client.java#L83
Enforce a policy for braces on control statements. It is recommended to use braces on 'if ... else'
statements and loop statements, even if they are optional. This usually makes the code clearer, and
helps prepare the future when you need to add another statement. That said, this rule lets you control
which statements are required to have braces via properties.
From 6.2.0 on, this rule supersedes WhileLoopMustUseBraces, ForLoopMustUseBraces, IfStmtMustUseBraces,
and IfElseStmtMustUseBraces.
ControlStatementBraces (Priority: 3, Ruleset: Code Style)
https://docs.pmd-code.org/snapshot/pmd_rules_java_codestyle.html#controlstatementbraces
|
|
Logger should be defined private static final and have the correct class:
common/client/src/main/java/zingg/common/client/Client.java#L38
A logger should normally be defined private static final and be associated with the correct class.
`private final Log log;` is also allowed for rare cases where loggers need to be passed around,
with the restriction that the logger needs to be passed into the constructor.
ProperLogger (Priority: 3, Ruleset: Error Prone)
https://docs.pmd-code.org/snapshot/pmd_rules_java_errorprone.html#properlogger
|
Artifacts
Produced during runtime
| Name | Size | Digest | |
|---|---|---|---|
|
PMD Report
Expired
|
57.5 KB |
sha256:5da7609339a0987953af0453d72506edc35922c19fc89c02d21831179d2f09ee
|
|