diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-24 14:16:07 +0100 |
---|---|---|
committer | Duarte Meneses <duarte.meneses@sonarsource.com> | 2015-11-24 14:21:20 +0100 |
commit | 5634bf689509aed3c48877469d4549ab7b5141a4 (patch) | |
tree | bb48c7504eab88f37e48bda7f6b23f869b570db1 /sonar-batch/src/main | |
parent | 0ef2119bf5961312426fe855b6e0beb82c46c297 (diff) | |
download | sonarqube-5634bf689509aed3c48877469d4549ab7b5141a4.tar.gz sonarqube-5634bf689509aed3c48877469d4549ab7b5141a4.zip |
SONAR-7037 Improve logging on authentication failure
Diffstat (limited to 'sonar-batch/src/main')
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java b/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java index 11bf530e8b3..b31741f1115 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java +++ b/sonar-batch/src/main/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoader.java @@ -19,8 +19,9 @@ */ package org.sonar.batch.repository; -import org.sonar.api.utils.HttpDownloader.HttpException; +import com.google.common.base.Throwables; +import org.sonar.api.utils.HttpDownloader.HttpException; import com.google.common.collect.HashBasedTable; import com.google.common.collect.Table; @@ -59,7 +60,7 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad fromCache.setValue(result.isFromCache()); } return processStream(result.get(), projectKey); - } catch (IllegalStateException e) { + } catch (RuntimeException e) { if (shouldThrow(e)) { throw e; } @@ -81,9 +82,11 @@ public class DefaultProjectRepositoriesLoader implements ProjectRepositoriesLoad } private static boolean shouldThrow(Exception e) { - if (e.getCause() != null && e.getCause() instanceof HttpException) { - HttpException http = (HttpException) e.getCause(); - return http.getResponseCode() != 404; + for (Throwable t : Throwables.getCausalChain(e)) { + if (t instanceof HttpException) { + HttpException http = (HttpException) t; + return http.getResponseCode() != 404; + } } return false; |