From 7a7877040fc184a89dc4a2e35d250daf7e832f24 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 3 Dec 2015 21:18:58 +0100 Subject: [PATCH] Polishing --- .../beans/factory/config/YamlProcessor.java | 32 ++++++++++--------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java index ad17364edc4..ac01eb74b7a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/config/YamlProcessor.java @@ -150,8 +150,8 @@ public abstract class YamlProcessor { private boolean process(MatchCallback callback, Yaml yaml, Resource resource) { int count = 0; try { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Loading from YAML: " + resource); + if (logger.isDebugEnabled()) { + logger.debug("Loading from YAML: " + resource); } Reader reader = new UnicodeReader(resource.getInputStream()); try { @@ -163,8 +163,8 @@ public abstract class YamlProcessor { } } } - if (this.logger.isDebugEnabled()) { - this.logger.debug("Loaded " + count + " document" + (count > 1 ? "s" : "") + + if (logger.isDebugEnabled()) { + logger.debug("Loaded " + count + " document" + (count > 1 ? "s" : "") + " from YAML resource: " + resource); } } @@ -183,8 +183,8 @@ public abstract class YamlProcessor { this.resolutionMethod != ResolutionMethod.OVERRIDE_AND_IGNORE) { throw new IllegalStateException(ex); } - if (this.logger.isWarnEnabled()) { - this.logger.warn("Could not load map from " + resource + ": " + ex.getMessage()); + if (logger.isWarnEnabled()) { + logger.warn("Could not load map from " + resource + ": " + ex.getMessage()); } } @@ -221,8 +221,8 @@ public abstract class YamlProcessor { properties.putAll(getFlattenedMap(map)); if (this.documentMatchers.isEmpty()) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Merging document (no matchers set)" + map); + if (logger.isDebugEnabled()) { + logger.debug("Merging document (no matchers set): " + map); } callback.process(properties, map); return true; @@ -233,8 +233,8 @@ public abstract class YamlProcessor { MatchStatus match = matcher.matches(properties); result = MatchStatus.getMostSpecific(match, result); if (match == MatchStatus.FOUND) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Matched document with document matcher: " + properties); + if (logger.isDebugEnabled()) { + logger.debug("Matched document with document matcher: " + properties); } callback.process(properties, map); return true; @@ -242,14 +242,16 @@ public abstract class YamlProcessor { } if (result == MatchStatus.ABSTAIN && this.matchDefault) { - if (this.logger.isDebugEnabled()) { - this.logger.debug("Matched document with default matcher: " + map); + if (logger.isDebugEnabled()) { + logger.debug("Matched document with default matcher: " + map); } callback.process(properties, map); return true; } - this.logger.debug("Unmatched document"); + if (logger.isDebugEnabled()) { + logger.debug("Unmatched document: " + map); + } return false; } @@ -300,7 +302,7 @@ public abstract class YamlProcessor { } } else { - result.put(key, value == null ? "" : value); + result.put(key, value != null ? value : ""); } } } @@ -328,7 +330,7 @@ public abstract class YamlProcessor { /** * Test if the given properties match. * @param properties the properties to test - * @return the status of the match. + * @return the status of the match */ MatchStatus matches(Properties properties); }