Skip to content

[GLUTEN-CORE] ResourceUtil fails to load JARs from paths with special characters (URL-encoded) #11673

@clee704

Description

@clee704

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions