REF-7: Support non-file resource URLs (WildFly/JBoss vfs:) in ResourceUtil (issue #80) - #86
Merged
Merged
Conversation
…eUtil (issue #80) ResourceUtil.getResourceAsFile only special-cased 'jar:' URLs and turned every other URL into a File via new File(url.toURI()). On WildFly/JBoss the classloader returns 'vfs:'/'vfszip:' URLs, for which that throws IllegalArgumentException ("URI scheme is not 'file'"), breaking resource loading during the authentication flow. Extract a package-private toFile(URL, String) that uses a plain 'file:' URL directly and stream-copies any other protocol (jar:, vfs:, vfszip:, ...) to a temporary file. Add a ResourceUtilTest case that simulates a WildFly vfs: URL and verifies it resolves to a readable file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
mthiim
approved these changes
Jul 3, 2026
…to temp file Files.createTempFile uses the resourceName as the temp-file prefix, and a prefix containing '/' (e.g. "config/oiosaml.properties" or a resource in WEB-INF/classes/config on WildFly VFS) is rejected with IllegalArgumentException. Use only the last path segment as the prefix and add an "oiosaml-" prefix to guarantee the minimum length. Addresses review feedback on #86. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #80
Summary
On WildFly/JBoss, loading resources failed with an
IllegalArgumentExceptionduring the authentication flow.Root cause:
ResourceUtil.getResourceAsFile()only special-casedjar:URLs and converted every other URL withnew File(url.toURI()). WildFly/JBoss serves classpath resources through its virtual file system, so the classloader returnsvfs:/vfszip:URLs.new File(uri)requires afile:scheme and throwsIllegalArgumentException: URI scheme is not "file"for those.Fix
Extract a package-private
toFile(URL, String)that:file:URL directly, andjar:,vfs:,vfszip:, ...) to a temporary file.This generalizes the previous jar-only handling to any non-
file:protocol, so no per-app-server special-casing is needed.Test
ResourceUtilTestgets a new case that simulates a WildFlyvfs:URL via a syntheticURLStreamHandler. It asserts that the oldnew File(url.toURI())throwsIllegalArgumentException(the #80 bug) and thattoFile()resolves the same URL to a readable file with the original content. Existingjar:/ classpath / external-file cases still pass.Full suite:
Tests run: 108, Failures: 0, Errors: 0.🤖 Generated with Claude Code