diff --git a/config/config/src/main/java/io/helidon/config/ClasspathSourceHelper.java b/config/config/src/main/java/io/helidon/config/ClasspathSourceHelper.java index 9e336397455..1eb1f2d0f8f 100644 --- a/config/config/src/main/java/io/helidon/config/ClasspathSourceHelper.java +++ b/config/config/src/main/java/io/helidon/config/ClasspathSourceHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023 Oracle and/or its affiliates. + * Copyright (c) 2017, 2024 Oracle and/or its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,16 +16,12 @@ package io.helidon.config; -import java.io.InputStream; import java.lang.System.Logger.Level; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.time.Instant; -import java.util.function.BiFunction; /** * Utilities for file-related source classes. @@ -74,40 +70,4 @@ static Path resourcePath(String resourceName) throws URISyntaxException { } } - static Instant resourceTimestamp(String resourceName) { - try { - Path resourcePath = resourcePath(resourceName); - if (resourcePath != null) { - return Files.getLastModifiedTime(resourcePath).toInstant(); - } - } catch (Exception ex) { - LOGGER.log(Level.DEBUG, "Error to get resource '" + resourceName + "' last modified time.", ex); - } - return Instant.EPOCH; - } - - static T content(String resource, - String description, - BiFunction processor) throws ConfigException { - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - - InputStream inputStream = classLoader.getResourceAsStream(resource); - - if (inputStream == null) { - LOGGER.log(Level.DEBUG, - String.format("Error to get %s using %s CONTEXT ClassLoader.", description, classLoader)); - throw new ConfigException(description + " does not exist. Used ClassLoader: " + classLoader); - } - Instant resourceTimestamp = resourceTimestamp(resource); - try { - LOGGER.log(Level.DEBUG, - String.format("Getting content from '%s'. Last modified at %s. Used ClassLoader: %s", - resourcePath(resource), resourceTimestamp, classLoader)); - } catch (Exception ex) { - LOGGER.log(Level.DEBUG, "Error to get resource '" + resource + "' path. Used ClassLoader: " + classLoader, ex); - } - - return processor.apply(inputStream, resourceTimestamp); - } - }