From 9dfa46f6902b7b134847ae20bc88b4a3968a99bb Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Tue, 18 Oct 2022 14:18:05 +0200 Subject: [PATCH] Remove GraalVM workaround in PathMatchingResourcePatternResolver Tested successfully using the following locally built GraalVM dev build. OpenJDK Runtime Environment GraalVM 22.3.0-dev (build 17.0.5+5-jvmci-22.3-b07) Closes gh-29214 --- .../PathMatchingResourcePatternResolver.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java index 66cd76c3d3ce..9aa4ca6dde64 100644 --- a/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java +++ b/spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java @@ -740,19 +740,6 @@ protected Set doFindPathMatchingFileResources(Resource rootDirResource URI rootDirUri; try { rootDirUri = rootDirResource.getURI(); - // If the URI is for a "resource" in the GraalVM native image file system, we have to - // ensure that the root directory does not end in a slash while simultaneously ensuring - // that the root directory is not an empty string (since Path#resolve throws an - // ArrayIndexOutOfBoundsException in a native image if the initial Path is created - // from an empty string). - String scheme = rootDirUri.getScheme(); - String path = rootDirUri.getPath(); - if ("resource".equals(scheme) && (path.length() > 1) && path.endsWith("/")) { - path = path.substring(0, path.length() - 1); - // Retain the fragment as well, since root folders in the native image - // file system are indexed via the fragment (e.g., resource:/#1). - rootDirUri = new URI(scheme, path, rootDirUri.getFragment()); - } } catch (Exception ex) { if (logger.isInfoEnabled()) {