@@ -150,8 +150,8 @@ protected Yaml createYaml() {
150
150
private boolean process (MatchCallback callback , Yaml yaml , Resource resource ) {
151
151
int count = 0 ;
152
152
try {
153
- if (this . logger .isDebugEnabled ()) {
154
- this . logger .debug ("Loading from YAML: " + resource );
153
+ if (logger .isDebugEnabled ()) {
154
+ logger .debug ("Loading from YAML: " + resource );
155
155
}
156
156
Reader reader = new UnicodeReader (resource .getInputStream ());
157
157
try {
@@ -163,8 +163,8 @@ private boolean process(MatchCallback callback, Yaml yaml, Resource resource) {
163
163
}
164
164
}
165
165
}
166
- if (this . logger .isDebugEnabled ()) {
167
- this . logger .debug ("Loaded " + count + " document" + (count > 1 ? "s" : "" ) +
166
+ if (logger .isDebugEnabled ()) {
167
+ logger .debug ("Loaded " + count + " document" + (count > 1 ? "s" : "" ) +
168
168
" from YAML resource: " + resource );
169
169
}
170
170
}
@@ -183,8 +183,8 @@ private void handleProcessError(Resource resource, IOException ex) {
183
183
this .resolutionMethod != ResolutionMethod .OVERRIDE_AND_IGNORE ) {
184
184
throw new IllegalStateException (ex );
185
185
}
186
- if (this . logger .isWarnEnabled ()) {
187
- this . logger .warn ("Could not load map from " + resource + ": " + ex .getMessage ());
186
+ if (logger .isWarnEnabled ()) {
187
+ logger .warn ("Could not load map from " + resource + ": " + ex .getMessage ());
188
188
}
189
189
}
190
190
@@ -221,8 +221,8 @@ private boolean process(Map<String, Object> map, MatchCallback callback) {
221
221
properties .putAll (getFlattenedMap (map ));
222
222
223
223
if (this .documentMatchers .isEmpty ()) {
224
- if (this . logger .isDebugEnabled ()) {
225
- this . logger .debug ("Merging document (no matchers set)" + map );
224
+ if (logger .isDebugEnabled ()) {
225
+ logger .debug ("Merging document (no matchers set): " + map );
226
226
}
227
227
callback .process (properties , map );
228
228
return true ;
@@ -233,23 +233,25 @@ private boolean process(Map<String, Object> map, MatchCallback callback) {
233
233
MatchStatus match = matcher .matches (properties );
234
234
result = MatchStatus .getMostSpecific (match , result );
235
235
if (match == MatchStatus .FOUND ) {
236
- if (this . logger .isDebugEnabled ()) {
237
- this . logger .debug ("Matched document with document matcher: " + properties );
236
+ if (logger .isDebugEnabled ()) {
237
+ logger .debug ("Matched document with document matcher: " + properties );
238
238
}
239
239
callback .process (properties , map );
240
240
return true ;
241
241
}
242
242
}
243
243
244
244
if (result == MatchStatus .ABSTAIN && this .matchDefault ) {
245
- if (this . logger .isDebugEnabled ()) {
246
- this . logger .debug ("Matched document with default matcher: " + map );
245
+ if (logger .isDebugEnabled ()) {
246
+ logger .debug ("Matched document with default matcher: " + map );
247
247
}
248
248
callback .process (properties , map );
249
249
return true ;
250
250
}
251
251
252
- this .logger .debug ("Unmatched document" );
252
+ if (logger .isDebugEnabled ()) {
253
+ logger .debug ("Unmatched document: " + map );
254
+ }
253
255
return false ;
254
256
}
255
257
@@ -300,7 +302,7 @@ else if (value instanceof Collection) {
300
302
}
301
303
}
302
304
else {
303
- result .put (key , value == null ? "" : value );
305
+ result .put (key , value != null ? value : "" );
304
306
}
305
307
}
306
308
}
@@ -328,7 +330,7 @@ public interface DocumentMatcher {
328
330
/**
329
331
* Test if the given properties match.
330
332
* @param properties the properties to test
331
- * @return the status of the match.
333
+ * @return the status of the match
332
334
*/
333
335
MatchStatus matches (Properties properties );
334
336
}
0 commit comments