From aad72d9f2bd072e2ab0282cf88285873f18dc238 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Fri, 3 Jan 2025 19:25:57 +0100 Subject: [PATCH] Improved debug log --- .../DefaultResourceResolver.java | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ph-commons/src/main/java/com/helger/commons/io/resourceresolver/DefaultResourceResolver.java b/ph-commons/src/main/java/com/helger/commons/io/resourceresolver/DefaultResourceResolver.java index cc2e373d7..a00fc75cf 100644 --- a/ph-commons/src/main/java/com/helger/commons/io/resourceresolver/DefaultResourceResolver.java +++ b/ph-commons/src/main/java/com/helger/commons/io/resourceresolver/DefaultResourceResolver.java @@ -104,9 +104,8 @@ private static ClassPathResource _resolveClassPathResource (final String sSystem final File aBaseFile = new File (sBaseURIWithoutPrefix).getParentFile (); // Concatenate the path with the URI to search - final String sNewPath = FilenameHelper.getCleanPath (aBaseFile == null ? sSystemId : aBaseFile.getPath () + - '/' + - sSystemId); + final String sNewPath = FilenameHelper.getCleanPath (aBaseFile == null ? sSystemId + : aBaseFile.getPath () + '/' + sSystemId); final ClassPathResource ret = new ClassPathResource (sNewPath, aClassLoader); CONDLOG.info ( () -> " [ClassPath] resolved base + system to " + ret); @@ -114,8 +113,8 @@ private static ClassPathResource _resolveClassPathResource (final String sSystem } @Nonnull - private static URLResource _resolveJarFileResource (@Nonnull final String sSystemId, @Nonnull final String sBaseURI) - throws MalformedURLException + private static URLResource _resolveJarFileResource (@Nonnull final String sSystemId, + @Nonnull final String sBaseURI) throws MalformedURLException { // Base URI is inside a jar file? Skip the JAR file // See issue #8 - use lastIndexOf here @@ -140,9 +139,8 @@ private static URLResource _resolveJarFileResource (@Nonnull final String sSyste final File aBaseFile = new File (sBasePath).getParentFile (); // Concatenate the path with the URI to search - final String sNewPath = FilenameHelper.getCleanPath (aBaseFile == null ? sSystemId : aBaseFile.getPath () + - '/' + - sSystemId); + final String sNewPath = FilenameHelper.getCleanPath (aBaseFile == null ? sSystemId + : aBaseFile.getPath () + '/' + sSystemId); final String sAggregatedPath; if (sPrefix.endsWith ("/") && sNewPath.startsWith ("/")) @@ -158,8 +156,8 @@ private static URLResource _resolveJarFileResource (@Nonnull final String sSyste } @Nonnull - private static URLResource _resolveURLResource (final String sSystemId, @Nonnull final URL aBaseURL) - throws MalformedURLException + private static URLResource _resolveURLResource (final String sSystemId, + @Nonnull final URL aBaseURL) throws MalformedURLException { // Take only the path String sBasePath = aBaseURL.getPath (); @@ -228,11 +226,11 @@ public static IReadableResource getResolvedResource (@Nullable final String sSys throw new IllegalArgumentException ("Both systemID and baseURI are null!"); if (LOGGER.isDebugEnabled ()) - LOGGER.debug ("Trying to resolve resource " + + LOGGER.debug ("Trying to resolve resource '" + sSystemId + - " from base " + + "' from base '" + sBaseURI + - (aClassLoader == null ? "" : " with ClassLoader " + aClassLoader)); + (aClassLoader == null ? "'" : "' with ClassLoader " + aClassLoader)); CONDLOG.info ( () -> "doStandardResourceResolving ('" + sSystemId + "', '" + sBaseURI + "', " + aClassLoader + ")");