diff options
author | Léo Geoffroy <leo.geoffroy@sonarsource.com> | 2023-05-08 11:17:08 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-05-08 20:03:47 +0000 |
commit | 204d9b7f21fb8807c8a53756d1234a00023a9206 (patch) | |
tree | 3443cc97597fdefd4736de1f7c8b37e87b85e4bb /sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap | |
parent | e3312c7db30756592236f803c5a9d37bc6de5483 (diff) | |
download | sonarqube-204d9b7f21fb8807c8a53756d1234a00023a9206.tar.gz sonarqube-204d9b7f21fb8807c8a53756d1234a00023a9206.zip |
SONAR-19110 Update Not Authorized message to include sonar.token
Diffstat (limited to 'sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap')
-rw-r--r-- | sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java index 5dfc85f4dd2..e3ba9e36e69 100644 --- a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java +++ b/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java @@ -105,16 +105,17 @@ public class DefaultScannerWsClient implements ScannerWsClient { response.close(); if (hasCredentials) { // credentials are not valid - throw MessageException.of(format("Not authorized. Please check the properties %s and %s.", - CoreProperties.LOGIN, CoreProperties.PASSWORD)); + throw MessageException.of(format("Not authorized. Please check the user token in the property '%s' or the credentials in the properties '%s' and '%s'.", + ScannerWsClientProvider.TOKEN_PROPERTY, CoreProperties.LOGIN, CoreProperties.PASSWORD)); } // not authenticated - see https://jira.sonarsource.com/browse/SONAR-4048 - throw MessageException.of(format("Not authorized. Analyzing this project requires authentication. Please provide a user token in %s" + - " or other credentials in %s and %s.", ScannerWsClientProvider.TOKEN_PROPERTY, CoreProperties.LOGIN, CoreProperties.PASSWORD)); + throw MessageException.of(format("Not authorized. Analyzing this project requires authentication. " + + "Please check the user token in the property '%s' or the credentials in the properties '%s' and '%s'.", + ScannerWsClientProvider.TOKEN_PROPERTY, CoreProperties.LOGIN, CoreProperties.PASSWORD)); } if (code == HTTP_FORBIDDEN) { throw MessageException.of("You're not authorized to analyze this project or the project doesn't exist on SonarQube" + - " and you're not authorized to create it. Please contact an administrator."); + " and you're not authorized to create it. Please contact an administrator."); } if (code == HTTP_BAD_REQUEST) { String jsonMsg = tryParseAsJsonError(response.content()); @@ -153,7 +154,7 @@ public class DefaultScannerWsClient implements ScannerWsClient { LOG.warn("Analysis executed with this token will fail after the expiration date."); } analysisWarnings.addUnique(warningMessage + "\nAfter this date, the token can no longer be used to execute the analysis. " - + "Please consider generating a new token and updating it in the locations where it is in use."); + + "Please consider generating a new token and updating it in the locations where it is in use."); } /** |