Skip to content

Commit

Permalink
[JENKINS-50064] - Suppress FindBugs warning in CLI, switch to the med…
Browse files Browse the repository at this point in the history
…ium level
  • Loading branch information
oleg-nenashev committed Mar 10, 2018
1 parent 20bc2e8 commit 5e0e553
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 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

0 comments on commit 5e0e553

Please sign in to comment.