Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/main/java/javax/validation/Validation.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,18 @@ public Configuration<?> configure() {
getDefaultValidationProviderResolver() :
this.resolver;

List<ValidationProvider<?>> resolvers;
List<ValidationProvider<?>> validationProviders;
try {
resolvers = resolver.getValidationProviders();
validationProviders = resolver.getValidationProviders();
}
catch ( RuntimeException re ) {
throw new ValidationException( "Unable to get available provider resolvers.", re );
}

if ( resolvers.size() == 0 ) {
//FIXME looks like an assertion error almost
throw new ValidationException( "Unable to find a default provider" );
if ( validationProviders.size() == 0 ) {
String msg = "Unable to create a Configuration, because no Bean Validation provider could be found." +
" Add a provider like Hibernate Validator (RI) to your classpath.";
throw new ValidationException( msg );
}

Configuration<?> config;
Expand All @@ -282,7 +283,7 @@ public Configuration<?> configure() {
* the current class if the current class loader is unavailable. The classloader is used to retrieve the Service Provider files.
* <p>
* This class implements the Service Provider pattern described <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider">here</a>.
* Since we cannot rely on Java 6 we have to reimplement the <code>Service</code> functionality.
* Since we cannot rely on Java 6 we have to re-implement the <code>Service</code> functionality.
* </p>
*
* @author Emmanuel Bernard
Expand Down Expand Up @@ -330,7 +331,7 @@ public List<ValidationProvider<?>> getValidationProviders() {
);

providers.add(
( ValidationProvider ) providerClass.newInstance()
(ValidationProvider) providerClass.newInstance()
);
}
name = reader.readLine();
Expand Down