sarutak opened a new pull request, #56125:
URL: https://github.com/apache/spark/pull/56125

   ### What changes were proposed in this pull request?
   This PR replaces `URL.getFile()` with `new File(url.toURI).getPath` (or `new 
File(url.toURI)`) in `SparkTestUtils.scala` to correctly handle classpath URLs 
containing percent-encoded characters (e.g., spaces encoded as `%20`).
   
   Four call sites are fixed:
   - `createCompiledClass`
   - `createJarWithJavaSources`
   - `createJarWithScalaSources`
   - `expandManifestClasspath`
   
   Additionally, a new test suite `SparkTestUtilsSuite` is added to cover both 
this fix and the `expandManifestClasspath` logic introduced in #55564.
   
   ### Why are the changes needed?
   `URL.getFile()` returns a percent-encoded string. When a classpath URL 
contains spaces or special characters (e.g., `C:\Program Files\...` or CI 
environments with spaces in paths), the encoded string (e.g., 
`/path%20with%20spaces/lib.jar`) is passed directly to the compiler or `new 
File(...)`, which fails to resolve the actual file. Using `url.toURI` properly 
decodes the path.
   
   Without this change, tests which use `SparkTestUtils` fails if the 
repository is in the path containing white spaces.
   ```
   $ build/sbt 'core/testOnly 
org.apache.spark.executor.ClassLoaderIsolationSuite
   ...
   
   [info] - SPARK-51537 Executor isolation avoids reloading plugin jars *** 
FAILED *** (1 second, 674 milliseconds)
   [info]   java.lang.AssertionError: assertion failed: Compiled file not 
found: /private/space containing path/spark/core/TestExecutorPlugin.class
   
   ...
   ```
   
   ### Does this PR introduce _any_ user-facing change?
   No.
   
   ### How was this patch tested?
   Confirmed `ClassLoaderIsolationSuite` passed even if the repository is in a 
space containing path.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   Generated-by: Claude (via Kiro CLI, auto model selection)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to