[GLUTEN-CORE] ResourceUtil fails to load JARs from paths with special characters (URL-encoded)
- Dominant language
- Scala
- Stars
- 1.6k
- Forks
- 657
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 80
Description
## Description
`ResourceUtil.getResources()` fails when Gluten is loaded from a JAR file located in a directory with special characters in its path (such as `@`, spaces, or other characters that get percent-encoded in URLs).
## Root Cause
`ClassLoader.getResources()` returns `URL` objects where special characters are percent-encoded (e.g., `@` → `%40`). `ResourceUtil` passes these URL-encoded paths directly to `new File(url.getPath())`, which expects filesystem paths, not URL-encoded strings. This causes `File.exists()` to return `false`, resulting in a `GlutenException`.
## Example
When JARs are cached in a path like:
```
~/.cache/coursier/v1/https/user%40domain.pkgs.visualstudio.com/project/_packaging/feed/maven/v1/org/apache/gluten/gluten-package/...
```
The `%40` in the path causes `ResourceUtil` to look for a non-existent directory/file.
## Fix
Use `URL.toURI()` and `new File(URI)` which properly decode percent-encoded characters, while also correctly preserving `+` characters (unlike `URLDecoder.decode()` which treats `+` as space).
PR: #11672
Contributor guide
Research direction
Start at ResourceUtil.getResources(), which is identified as the failing entry point. Reproduce loading Gluten from a JAR path containing spaces or other percent-encoded characters, then verify that resources load successfully without a GlutenException and that literal '+' characters remain intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 25/100