diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2013-11-21 15:22:50 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2013-11-21 15:22:50 +0100 |
commit | 8ef7d02997f1a8c49b8030ca7f352eed14d99827 (patch) | |
tree | a7d6e81af27f7fcd35aefcbbe83b2e8102fc190d /sonar-core | |
parent | 3e1e5b64dabe602e86fd812f9536c50b0f224007 (diff) | |
download | sonarqube-8ef7d02997f1a8c49b8030ca7f352eed14d99827.tar.gz sonarqube-8ef7d02997f1a8c49b8030ca7f352eed14d99827.zip |
SONAR-4775 Do not log twice time warnings
Diffstat (limited to 'sonar-core')
-rw-r--r-- | sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java b/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java index cfed80d225c..313518f77b5 100644 --- a/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java +++ b/sonar-core/src/main/java/org/sonar/core/technicaldebt/TechnicalDebtXMLImporter.java @@ -76,7 +76,6 @@ public class TechnicalDebtXMLImporter implements ServerExtension { cursor.getStreamReader().closeCompletely(); } catch (XMLStreamException e) { - LOG.error("XML is not valid", e); messages.addErrorText("XML is not valid: " + e.getMessage()); } return model; @@ -163,16 +162,11 @@ public class TechnicalDebtXMLImporter implements ServerExtension { function.setTextValue(TechnicalDebtRequirement.FUNCTION_LINEAR); CharacteristicProperty offset = characteristic.getProperty(TechnicalDebtRequirement.PROPERTY_OFFSET); offset.setValue(0d); - - String message = String.format("Linear with threshold function is no more used, function of the requirement '%s:%s' is replaced by linear.", - characteristic.getRule().getRepositoryKey(), characteristic.getRule().getKey()); - LOG.warn(message); - messages.addWarningText(message); + messages.addWarningText(String.format("Linear with threshold function is no more used, function of the requirement '%s:%s' is replaced by linear.", + characteristic.getRule().getRepositoryKey(), characteristic.getRule().getKey())); } else if ("constant_resource".equals(function.getTextValue())) { - String message = String.format("Constant/file function is no more used, requirements '%s:%s' are ignored.", - characteristic.getRule().getRepositoryKey(), characteristic.getRule().getKey()); - LOG.warn(message); - messages.addWarningText(message); + messages.addWarningText(String.format("Constant/file function is no more used, requirements '%s:%s' are ignored.", + characteristic.getRule().getRepositoryKey(), characteristic.getRule().getKey())); return null; } } @@ -194,9 +188,7 @@ public class TechnicalDebtXMLImporter implements ServerExtension { try { value = NumberUtils.createDouble(s); } catch (NumberFormatException ex) { - String message = String.format("Cannot import value '%s' for field %s - Expected a numeric value instead", s, key); - LOG.error(message, ex); - messages.addErrorText(message); + messages.addErrorText(String.format("Cannot import value '%s' for field %s - Expected a numeric value instead", s, key)); } } else if (StringUtils.equals(node, PROPERTY_TEXT_VALUE)) { textValue = c.collectDescendantText().trim(); |