Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to extend URL protocols handled by ClasspathIterable #360

Closed
ghost opened this issue Jul 16, 2012 · 1 comment
Closed

Unable to extend URL protocols handled by ClasspathIterable #360

ghost opened this issue Jul 16, 2012 · 1 comment

Comments

@ghost
Copy link

ghost commented Jul 16, 2012

I'm working to integrate Cucumber with the Arquillian test framework, and I found a major problem with the ClasspathResourceLoader: there is no way to extend the capabilities of the resource loader to be able to conditionally load resources based on the protocol of each resource's URL. If there's a funky URL protocol that doesn't refer to a filesystem resource or a JAR file, the ClasspathResourceLoader will fail to load the resource.

I ran into this problem while executing Cucumber tests with Arquillian and JBoss AS 7.1.1.Final. When the Cucumber tests are running within JBoss AS, each resource URL returned by ClassLoader.getResources() uses the "vfs" protocol to indicate handling by the JBoss Virtual File System.

Here's the problem:

  • ClasspathResourceLoader creates ClasspathIterable.
  • ClasspathIterable creates ZipResourceIterator for any resource URL's with "jar" protocol or FileResourceIterator for all other protocols.
  • FileResourceIterator receives invalid path to resource that doesn't exist because JBoss VFS abstracts away the physical location of all resources.
  • I get IllegalArgumentException: "Not a file or directory: C:\jboss-as\install\dir\bin\content\weirdo-location-that-doesn't-really-exist-unless-you-load-me-using-vfs".

Currently, there is no way to extend or modify the resource loading behavior of the ClasspathResourceLoader class. I'm looking at having to completely reimplement the ResourceLoader interface and manually providing Backend implementations to the Runtime because of the hard dependency on the ClasspathResourceLoader class in Runtime.loadBackends(). Most of the classes used by the ClasspathResourceLoader are also package-private, so existing code cannot be reused.

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant