Issue Type: Bug Bug
Affects Versions: 1.0 final
Assignee: Unassigned
Components: spec-general
Created: 19/Jun/12 9:22 AM
Description:

Currently the code for discovering the service files in DefaultValidationProviderResolver looks like:

public List<ValidationProvider<?>> getValidationProviders() {
	ClassLoader classloader = GetClassLoader.fromContext();
	if ( classloader == null ) {
		classloader = GetClassLoader.fromClass( DefaultValidationProviderResolver.class );
	}

	List<ValidationProvider<?>> providers;
	synchronized ( providersPerClassloader ) {
		providers = providersPerClassloader.get( classloader );
	}

	if ( providers == null ) {
		providers = new ArrayList<ValidationProvider<?>>();
		String name = null;
		try {
			Enumeration<URL> providerDefinitions = classloader.getResources( SERVICES_FILE );
			while ( providerDefinitions.hasMoreElements() ) {
                          ...
			}
		}
		 
                ...
			
		synchronized ( providersPerClassloader ) {
			providersPerClassloader.put( classloader, providers );
		}
	}

	return providers;
}

The current code only checks whether the context class loader is null. If not only this context class loader is used to locate the service file. Only if the context class loader is null the current class loader is used.
A better approach is to load the service file from the context file loader and then try the current class loader in case no service file is found.

Fix Versions: 1.1.next
Project: Bean Validation
Priority: Major Major
Reporter: Hardy Ferentschik
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira