jclouds/jclouds — pull request #319 by iocanel (2012-01-16 22:40:10+00:00)
Title: Class loading issue in JcloudsVersion prevents jclouds 1.3.0 to work under OSGi

JcloudsVersion uses the maven metadata in order to identify the version of jclouds. It uses the Thread Context ClassLoader in order to load the maven metadata resources.

This works fine when using flat / hirerachical classloaders since the classloader has broad visibility. However, this doesn't work at all under OSGi and causes an NPE.

Since we are interesting in a specific artifact (jclouds-core) and the loading is taken care by JcloudsVersion class (part of the artifact) the ideal way, would be to use the class loader that is responsible for load JcloudsVersion class.

This tiny little patch does exactly this.