Skip to content

Commit 759757a

Browse files
committed
4.x: Remove unused code from ResourceUtil
1 parent f05e104 commit 759757a

File tree

1 file changed

+1
-47
lines changed

1 file changed

+1
-47
lines changed

common/configurable/src/main/java/io/helidon/common/configurable/ResourceUtil.java

Lines changed: 1 addition & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2023 Oracle and/or its affiliates.
2+
* Copyright (c) 2018, 2025 Oracle and/or its affiliates.
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.
@@ -18,24 +18,17 @@
1818

1919
import java.io.IOException;
2020
import java.io.InputStream;
21-
import java.net.InetSocketAddress;
2221
import java.net.Proxy;
2322
import java.net.URI;
2423
import java.nio.file.Files;
2524
import java.nio.file.Path;
26-
import java.nio.file.Paths;
27-
import java.util.Base64;
2825
import java.util.Objects;
29-
import java.util.Optional;
30-
31-
import io.helidon.common.config.Config;
3226

3327
/**
3428
* Utilities to move private static methods from interface,
3529
* as javadoc fails when using source 8.
3630
*/
3731
final class ResourceUtil {
38-
private static final int DEFAULT_PROXY_PORT = 80;
3932

4033
private ResourceUtil() {
4134
}
@@ -112,43 +105,4 @@ static InputStream toIs(URI uri, Proxy proxy) {
112105
throw new ResourceException("Failed to open stream to uri: " + uri, e);
113106
}
114107
}
115-
116-
static Optional<Resource> fromConfigPath(Config config) {
117-
return config.asString()
118-
.map(Paths::get)
119-
.map(Resource::create);
120-
}
121-
122-
static Optional<Resource> fromConfigB64Content(Config config) {
123-
return config.asString()
124-
.map(Base64.getDecoder()::decode)
125-
.map(content -> Resource.create(config.key() + ".content", content));
126-
}
127-
128-
static Optional<Resource> fromConfigContent(Config config) {
129-
return config.asString()
130-
.map(content -> Resource.create(config.key() + ".content-plain", content));
131-
}
132-
133-
static Optional<Resource> fromConfigUrl(Config config) {
134-
return config.as(URI.class)
135-
.map(uri -> config.get("proxy-host").asString()
136-
.map(proxyHost -> {
137-
if (config.get("use-proxy").asBoolean().orElse(true)) {
138-
Proxy proxy = new Proxy(Proxy.Type.HTTP,
139-
new InetSocketAddress(proxyHost,
140-
config.get("proxy-port").asInt().orElse(
141-
DEFAULT_PROXY_PORT)));
142-
return Resource.create(uri, proxy);
143-
} else {
144-
return Resource.create(uri);
145-
}
146-
})
147-
.orElseGet(() -> Resource.create(uri)));
148-
}
149-
150-
static Optional<Resource> fromConfigResourcePath(Config config) {
151-
return config.asString()
152-
.map(Resource::create);
153-
}
154108
}

0 commit comments

Comments
 (0)