dennyac opened a new pull request, #8919:
URL: https://github.com/apache/hadoop/pull/8919

   ### Description of PR
   
   `FileSystem.Cache.Key` normalizes URI schemes to lowercase per RFC 3986 ยง3.1 
(HADOOP-3785), and `FileSystem.checkPath` compares schemes case-insensitively. 
However, `FileSystem.get(URI, Configuration)` and 
`FileSystem.getFileSystemClass(String, Configuration)` used the raw 
`uri.getScheme()` string when:
   
   1. Checking `fs.<scheme>.impl.disable.cache` in `FileSystem.get(URI, 
Configuration)`
   2. Comparing the URI scheme against `getDefaultUri(conf).getScheme()` when 
authority is omitted in `FileSystem.get` and `FileSystem.newInstance`
   3. Looking up `fs.<scheme>.impl` in `Configuration` and 
`SERVICE_FILE_SYSTEMS` in `FileSystem.getFileSystemClass(String, Configuration)`
   
   As a result, passing an uppercase or mixed-case URI scheme (e.g. 
`ABFSS://...` or `FILE://...`) missed `fs.<scheme>.impl.disable.cache=true` 
(falling through to `CACHE.get`, which lowercases the key and returns a cached 
instance despite caching being disabled) and failed on a cache miss or direct 
`getFileSystemClass` call with `UnsupportedFileSystemException`.
   
   This change normalizes non-null `scheme` strings to lowercase via 
`StringUtils.toLowerCase` in `FileSystem.get`, `FileSystem.getFileSystemClass`, 
and `loadFileSystems`, and uses `equalsIgnoreCase` when comparing against the 
default URI scheme in `FileSystem.get` and `FileSystem.newInstance`.
   
   Contains content generated by GitHub Copilot.
   
   ### How was this patch tested?
   
   Ran `mvn test -pl hadoop-common-project/hadoop-common 
-Dtest=TestFileSystemCaching,TestDefaultUri,TestFileSystemInitialization` and 
`mvn checkstyle:checkstyle -pl hadoop-common-project/hadoop-common`.
   
   ### For code changes:
   
   - [ ] Does the title of this PR start with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: Have the integration tests been executed and the 
endpoint
         declared according to the connector-specific documentation? *Note: 
Automated CI
         testing doesn't cover all cases so manual testing with cloud storage 
is still
         required.*
   - [x] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [x] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   ### AI Tooling
   
   If an AI tool was used:
   
   - [x] The PR includes the phrase "Contains content generated by <tool>"
         where <tool> is the name of the AI tool used.
   - [x] My use of AI contributions follows the ASF legal policy
         https://www.apache.org/legal/generative-tooling.html
   


-- 
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]

  • [PR] Normalize URI scheme to l... dennyac (via GitHub) via common-issues

Reply via email to