Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using lambda in PropertiesConfigSource #1279

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -74,11 +76,14 @@ public PropertiesConfigSource(Properties properties, String name, int defaultOrd
public static Map<String, ConfigValue> 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;
Expand Down
Loading