diff --git a/src/main/java/org/sonarlint/intellij/config/global/SonarQubeServer.java b/src/main/java/org/sonarlint/intellij/config/global/SonarQubeServer.java index 62c8cc963a..28448ef999 100644 --- a/src/main/java/org/sonarlint/intellij/config/global/SonarQubeServer.java +++ b/src/main/java/org/sonarlint/intellij/config/global/SonarQubeServer.java @@ -170,12 +170,20 @@ public Builder setEnableProxy(boolean enableProxy) { } public Builder setToken(@Nullable String token) { - this.token = PasswordUtil.encodePassword(token); + if (token == null) { + this.token = null; + } else { + this.token = PasswordUtil.encodePassword(token); + } return this; } public Builder setPassword(@Nullable String password) { - this.password = PasswordUtil.encodePassword(password); + if (password == null) { + this.password = null; + } else { + this.password = PasswordUtil.encodePassword(password); + } return this; } diff --git a/src/main/java/org/sonarlint/intellij/util/SonarLintUtils.java b/src/main/java/org/sonarlint/intellij/util/SonarLintUtils.java index ea68ae53c8..4886ab163c 100644 --- a/src/main/java/org/sonarlint/intellij/util/SonarLintUtils.java +++ b/src/main/java/org/sonarlint/intellij/util/SonarLintUtils.java @@ -256,7 +256,7 @@ public static ServerConfiguration getServerConfiguration(SonarQubeServer server) .connectTimeoutMilliseconds(CONNECTION_TIMEOUT_MS) .readTimeoutMilliseconds(CONNECTION_TIMEOUT_MS) .url(server.getHostUrl()); - if (server.getToken() != null) { + if (StringUtil.isNotEmpty(server.getToken())) { serverConfigBuilder.token(server.getToken()); } else { serverConfigBuilder.credentials(server.getLogin(), server.getPassword());