Skip to content

Commit

Permalink
Merge pull request #3338 from oleg-nenashev/findbugs/JENKINS-50064
Browse files Browse the repository at this point in the history
Cleanup FindBugs in CLI + some refactoring
  • Loading branch information
oleg-nenashev committed Mar 18, 2018
2 parents 34b1e83 + de86f32 commit bb89137
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
10 changes: 10 additions & 0 deletions cli/pom.xml
Expand Up @@ -13,6 +13,11 @@
<name>Jenkins cli</name>
<description>Command line interface for Jenkins</description>

<properties>
<!-- TODO: remove once Medium level is set in the core (JENKINS-36716) -->
<findbugs.threshold>Medium</findbugs.threshold>
</properties>

<dependencies>
<dependency>
<groupId>org.powermock</groupId>
Expand Down Expand Up @@ -67,6 +72,11 @@
<artifactId>trilead-ssh2</artifactId>
<version>build214-jenkins-1</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
Expand Down
3 changes: 3 additions & 0 deletions cli/src/main/java/hudson/cli/SSHCLI.java
Expand Up @@ -51,6 +51,8 @@
import org.apache.sshd.common.util.io.NoCloseOutputStream;
import org.apache.sshd.common.util.security.SecurityUtils;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Implements SSH connection mode of {@link CLI}.
* In a separate class to avoid any class loading of {@code sshd-core} when not using {@code -ssh} mode.
Expand All @@ -59,6 +61,7 @@
*/
class SSHCLI {

@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE", justification = "Due to whatever reason FindBugs reports it fot try-with-resources")
static int sshConnection(String jenkinsUrl, String user, List<String> args, PrivateKeyProvider provider, final boolean strictHostKey) throws IOException {
Logger.getLogger(SecurityUtils.class.getName()).setLevel(Level.WARNING); // suppress: BouncyCastle not registered, using the default JCE provider
URL url = new URL(jenkinsUrl + "login");
Expand Down
3 changes: 0 additions & 3 deletions core/pom.xml
Expand Up @@ -42,8 +42,6 @@ THE SOFTWARE.
<stapler.version>1.254</stapler.version>
<spring.version>2.5.6.SEC03</spring.version>
<groovy.version>2.4.11</groovy.version>
<!-- TODO: Actually many issues are being filtered by src/findbugs/findbugs-excludes.xml -->
<findbugs.failOnError>true</findbugs.failOnError>
</properties>

<dependencies>
Expand Down Expand Up @@ -600,7 +598,6 @@ THE SOFTWARE.
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Expand Up @@ -107,6 +107,7 @@ THE SOFTWARE.
<remoting.version>3.18</remoting.version>
<remoting.minimum.supported.version>2.60</remoting.minimum.supported.version>

<!-- TODO: JENKINS-36716 - Switch to Medium once FindBugs is cleaned up, 430 issues on Mar 10, 2018 -->
<findbugs.effort>Max</findbugs.effort>
<findbugs.threshold>High</findbugs.threshold>
<findbugs.excludeFilterFile>../src/findbugs/findbugs-excludes.xml</findbugs.excludeFilterFile>
Expand Down

0 comments on commit bb89137

Please sign in to comment.