From 511fd39f79112b5c7c95a98cc21ca2c79a5a349c Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Wed, 1 Mar 2017 11:21:37 +0100 Subject: [PATCH] SONAR-8460 Remove isEmpty from Errors --- .../src/main/java/org/sonar/server/exceptions/Errors.java | 4 ---- .../server/qualitygate/QualityGateConditionsUpdater.java | 2 +- .../java/org/sonar/server/qualitygate/QualityGateUpdater.java | 2 +- .../main/java/org/sonar/server/qualitygate/QualityGates.java | 2 +- .../src/main/java/org/sonar/server/rule/RuleCreator.java | 2 +- 5 files changed, 4 insertions(+), 8 deletions(-) diff --git a/server/sonar-server/src/main/java/org/sonar/server/exceptions/Errors.java b/server/sonar-server/src/main/java/org/sonar/server/exceptions/Errors.java index 85f91f986be..e0045390bbb 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/exceptions/Errors.java +++ b/server/sonar-server/src/main/java/org/sonar/server/exceptions/Errors.java @@ -54,10 +54,6 @@ public class Errors { return messages; } - public boolean isEmpty() { - return messages.isEmpty(); - } - @Override public String toString() { return MoreObjects.toStringHelper(this) diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java index b06cc208c41..831d88dcb22 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateConditionsUpdater.java @@ -135,7 +135,7 @@ public class QualityGateConditionsUpdater { checkThresholds(warningThreshold, errorThreshold, errors); checkPeriod(metric, period, errors); checkRatingMetric(metric, warningThreshold, errorThreshold, period, errors); - if (!errors.isEmpty()) { + if (!errors.messages().isEmpty()) { throw BadRequestException.create(errors); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateUpdater.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateUpdater.java index 645cd0f61f1..7afedf22db0 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateUpdater.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGateUpdater.java @@ -52,7 +52,7 @@ public class QualityGateUpdater { } else { checkQualityGateDoesNotAlreadyExist(qGateId, name, errors); } - if (!errors.isEmpty()) { + if (!errors.messages().isEmpty()) { throw BadRequestException.create(errors); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGates.java b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGates.java index 506ab073ac8..2c508e65da1 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGates.java +++ b/server/sonar-server/src/main/java/org/sonar/server/qualitygate/QualityGates.java @@ -232,7 +232,7 @@ public class QualityGates { } else { checkQgateNotAlreadyExists(updatingQgateId, name, errors); } - if (!errors.isEmpty()) { + if (!errors.messages().isEmpty()) { throw BadRequestException.create(errors); } } diff --git a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java index 1ab82109635..6ce431fb454 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java +++ b/server/sonar-server/src/main/java/org/sonar/server/rule/RuleCreator.java @@ -118,7 +118,7 @@ public class RuleCreator { } } - if (!errors.isEmpty()) { + if (!errors.messages().isEmpty()) { throw BadRequestException.create(errors); } } -- 2.39.5