11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1717package org .springframework .beans .factory .config ;
1818
1919import java .io .IOException ;
20- import java .io .InputStream ;
20+ import java .io .Reader ;
2121import java .util .AbstractMap ;
2222import java .util .Arrays ;
2323import java .util .Collection ;
3535import org .yaml .snakeyaml .constructor .Constructor ;
3636import org .yaml .snakeyaml .nodes .MappingNode ;
3737import org .yaml .snakeyaml .parser .ParserException ;
38+ import org .yaml .snakeyaml .reader .UnicodeReader ;
3839
3940import org .springframework .core .io .Resource ;
4041import org .springframework .util .Assert ;
@@ -155,9 +156,9 @@ private boolean process(MatchCallback callback, Yaml yaml, Resource resource) {
155156 if (this .logger .isDebugEnabled ()) {
156157 this .logger .debug ("Loading from YAML: " + resource );
157158 }
158- InputStream stream = resource .getInputStream ();
159+ Reader reader = new UnicodeReader ( resource .getInputStream () );
159160 try {
160- for (Object object : yaml .loadAll (stream )) {
161+ for (Object object : yaml .loadAll (reader )) {
161162 if (object != null && process (asMap (object ), callback )) {
162163 count ++;
163164 if (this .resolutionMethod == ResolutionMethod .FIRST_FOUND ) {
@@ -171,7 +172,7 @@ private boolean process(MatchCallback callback, Yaml yaml, Resource resource) {
171172 }
172173 }
173174 finally {
174- stream .close ();
175+ reader .close ();
175176 }
176177 }
177178 catch (IOException ex ) {
0 commit comments