1
1
/*
2
- * Copyright 2002-2014 the original author or authors.
2
+ * Copyright 2002-2015 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
17
17
package org .springframework .beans .factory .config ;
18
18
19
19
import java .io .IOException ;
20
- import java .io .InputStream ;
20
+ import java .io .Reader ;
21
21
import java .util .AbstractMap ;
22
22
import java .util .Arrays ;
23
23
import java .util .Collection ;
35
35
import org .yaml .snakeyaml .constructor .Constructor ;
36
36
import org .yaml .snakeyaml .nodes .MappingNode ;
37
37
import org .yaml .snakeyaml .parser .ParserException ;
38
+ import org .yaml .snakeyaml .reader .UnicodeReader ;
38
39
39
40
import org .springframework .core .io .Resource ;
40
41
import org .springframework .util .Assert ;
@@ -155,9 +156,9 @@ private boolean process(MatchCallback callback, Yaml yaml, Resource resource) {
155
156
if (this .logger .isDebugEnabled ()) {
156
157
this .logger .debug ("Loading from YAML: " + resource );
157
158
}
158
- InputStream stream = resource .getInputStream ();
159
+ Reader reader = new UnicodeReader ( resource .getInputStream () );
159
160
try {
160
- for (Object object : yaml .loadAll (stream )) {
161
+ for (Object object : yaml .loadAll (reader )) {
161
162
if (object != null && process (asMap (object ), callback )) {
162
163
count ++;
163
164
if (this .resolutionMethod == ResolutionMethod .FIRST_FOUND ) {
@@ -171,7 +172,7 @@ private boolean process(MatchCallback callback, Yaml yaml, Resource resource) {
171
172
}
172
173
}
173
174
finally {
174
- stream .close ();
175
+ reader .close ();
175
176
}
176
177
}
177
178
catch (IOException ex ) {
0 commit comments