diff --git a/implementation/src/main/java/io/smallrye/config/PropertiesConfigSource.java b/implementation/src/main/java/io/smallrye/config/PropertiesConfigSource.java index 453f8a0e0..00ca4efe8 100644 --- a/implementation/src/main/java/io/smallrye/config/PropertiesConfigSource.java +++ b/implementation/src/main/java/io/smallrye/config/PropertiesConfigSource.java @@ -19,11 +19,13 @@ import java.io.BufferedReader; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.UncheckedIOException; import java.net.URL; import java.util.Map; import java.util.Properties; +import java.util.function.Consumer; import io.smallrye.common.classloader.ClassPathUtils; import io.smallrye.config.common.utils.ConfigSourceUtil; @@ -74,11 +76,14 @@ public PropertiesConfigSource(Properties properties, String name, int defaultOrd public static Map urlToConfigValueMap(URL locationOfProperties, String name, int ordinal) throws IOException { ConfigValueProperties properties = new ConfigValueProperties(name, ordinal); - ClassPathUtils.consumeStream(locationOfProperties, inputStream -> { - try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, UTF_8))) { - properties.load(reader); - } catch (IOException e) { - throw new UncheckedIOException(e); + ClassPathUtils.consumeStream(locationOfProperties, new Consumer<>() { + @Override + public void accept(InputStream inputStream) { + try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, UTF_8))) { + properties.load(reader); + } catch (IOException e) { + throw new UncheckedIOException(e); + } } }); return properties;