Handle 'bundle' protocol in Resources.isDirectory. Fixes #3212

Within an OSGi container, URLs' protocol is "bundle://".

In order to detect if a resource is a directory, this fix
rely on the class loader's behavior, which differ between
the standalone JVM and within an OSGi environment.
Most notably, ClassLoader.getResource returns differently
when the resource's name end with a slash.

In a standard JVM, getResource doesn't care of ending slashes,
and return the URL of any existing resources. In an OSGi container
(tested with Apache Felix), ending slashe refers to a directory
(return null otherwise).

In order to test Resources.isDirectory when the protocol is "bundle://",
there are 2 options:
a) run the test within an OSGi container (using Pax Exam),
b) simulate the behavior of an OSGi class loader, which is the
implemented solution.
Since the logic for handling jars and bundles is fundamentally different, I think it makes sense to have two separate case statements here.  Even if some of the code is shared, that code should be pulled out into a helper function if you want to share it.