Skip to content

Commit f8d7205

Browse files
csviriCopilot
andcommitted
Apply suggestions from code review
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Attila Mészáros <a_meszaros@apple.com>
1 parent 1e52c77 commit f8d7205

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

operator-framework/src/main/java/io/javaoperatorsdk/operator/config/loader/provider/PropertiesConfigProvider.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.javaoperatorsdk.operator.config.loader.provider;
1717

18-
import java.io.File;
1918
import java.io.IOException;
2019
import java.io.InputStream;
2120
import java.io.UncheckedIOException;
@@ -50,8 +49,8 @@ public static PropertiesConfigProvider systemProperties() {
5049
/**
5150
* Loads properties from the given file path.
5251
*
53-
* @throws UncheckedIOException if the file cannot be read. Does not throw exception if the file
54-
* not exists.
52+
* @throws UncheckedIOException if the file cannot be read. Does not throw an exception if the
53+
* file does not exist.
5554
*/
5655
public PropertiesConfigProvider(String path) {
5756
this(Path.of(path));
@@ -60,8 +59,8 @@ public PropertiesConfigProvider(String path) {
6059
/**
6160
* Loads properties from the given file path.
6261
*
63-
* @throws UncheckedIOException if the file cannot be read. Does not throw exception if the file
64-
* not exists.
62+
* @throws UncheckedIOException if the file cannot be read. Does not throw an exception if the
63+
* file does not exist.
6564
*/
6665
public PropertiesConfigProvider(Path path) {
6766
this.properties = load(path);
@@ -85,7 +84,7 @@ public <T> Optional<T> getValue(String key, Class<T> type) {
8584
}
8685

8786
private static Properties load(Path path) {
88-
if (!new File(path.toString()).exists()) {
87+
if (!Files.exists(path)) {
8988
log.warn("{} does not exist", path);
9089
return new Properties();
9190
}

operator-framework/src/main/java/io/javaoperatorsdk/operator/config/loader/provider/YamlConfigProvider.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
*/
1616
package io.javaoperatorsdk.operator.config.loader.provider;
1717

18-
import java.io.File;
1918
import java.io.IOException;
2019
import java.io.InputStream;
2120
import java.io.UncheckedIOException;
@@ -52,8 +51,8 @@ public class YamlConfigProvider implements ConfigProvider {
5251
/**
5352
* Loads YAML from the given file path.
5453
*
55-
* @throws UncheckedIOException if the file cannot be read. Does not throw exception if the file
56-
* not exists.
54+
* @throws UncheckedIOException if the file cannot be read. Does not throw an exception if the
55+
* file does not exist.
5756
*/
5857
public YamlConfigProvider(String path) {
5958
this(Path.of(path));
@@ -62,8 +61,8 @@ public YamlConfigProvider(String path) {
6261
/**
6362
* Loads YAML from the given file path.
6463
*
65-
* @throws UncheckedIOException if the file cannot be read. Does not throw exception if the file
66-
* not exists.
64+
* @throws UncheckedIOException if the file cannot be read. Does not throw an exception if the
65+
* file does not exist.
6766
*/
6867
public YamlConfigProvider(Path path) {
6968
this.data = load(path);
@@ -96,7 +95,7 @@ public <T> Optional<T> getValue(String key, Class<T> type) {
9695

9796
@SuppressWarnings("unchecked")
9897
private static Map<String, Object> load(Path path) {
99-
if (!new File(path.toString()).exists()) {
98+
if (!Files.exists(path)) {
10099
log.warn("{} does not exist", path);
101100
return Map.of();
102101
}

0 commit comments

Comments
 (0)