[hibernate-issues] [Hibernate-JIRA] Commented: (BVTCK-11) Wrong usage of context classloader to discover resources in META-INF/services

David Jencks (JIRA) noreply at atlassian.com
Wed Aug 24 20:00:04 EDT 2011


    [ http://opensource.atlassian.com/projects/hibernate/browse/BVTCK-11?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=43348#comment-43348 ] 

David Jencks commented on BVTCK-11:
-----------------------------------

Sorry we (geronimo) let this drop for a while since we found a workaround that is now causing more serious problems.  IIUC everyone agrees that the current test is invalid.  Can it be excluded right now?

I think the proposed solution would work with geronimo.  However, I don't think it tests the assertion and I'm pretty sure the proposed default spi implementation is not what you want (what loader is actually returned?).

The spec says the services file has to be in a jar file.  If you mean this, then the test should be supplied the location of said jar file, verify its a jar file and not a directory or some other kind of classloader backing (e.g. a database), look inside just that jar file, and get the services file out. If its really a jar file rather than say an osgi bundle with bundle-classpath or osgi fragment, then there can only be one services file in the jar.

If you don't actually mean the services file needs to be in a jar file, just accessible through a classloader, then the proposed pull request is probably ok although the spec needs adjustment.  After you clarify this we can try out the proposal.  Meanwhile we'd like the test excluded.

> Wrong usage of context classloader to discover resources in META-INF/services
> -----------------------------------------------------------------------------
>
>                 Key: BVTCK-11
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/BVTCK-11
>             Project: Bean Validation TCK
>          Issue Type: Bug
>          Components: TCK Appeal
>    Affects Versions: 1.0.4.GA
>            Reporter: Hardy Ferentschik
>            Assignee: Emmanuel Bernard
>             Fix For: 1.1.0
>
>   Original Estimate: 8h
>  Remaining Estimate: 8h
>
> *Problem Description*:
> The test uses the context classloader to discover all META-INF/services/javax.validation.spi.ValidationProvider resources and checks whether one of the resource files contains the ValidationProvider currently under the test.
> This method of checking for ValidationProvider might not work on all containers. Especially on containers with constrained classloaders (e.g. OSGi). The Bean Validation specification in section 4.4.4.1 talks about this exact problem. That's why the test should be using ValidationProviderResolver API to check for right provider instead of looking for the resource files.
> *Tests affected*: 
> org.hibernate.jsr303.tck.tests.bootstrap.ValidationProviderResolverTest#testServiceFileExists()

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list