HHH-9689 Avoid NPE when trying to load non-existent properties resource

This commit is contained in:
Gunnar Morling 2015-03-27 12:14:51 +01:00 committed by Steve Ebersole
parent 1f50efa34c
commit 30240beded
1 changed files with 5 additions and 1 deletions

View File

@ -39,7 +39,6 @@ import org.hibernate.boot.registry.BootstrapServiceRegistry;
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
import org.hibernate.internal.util.ValueHolder;
import org.hibernate.internal.util.config.ConfigurationException;
import org.jboss.logging.Logger;
/**
@ -121,6 +120,11 @@ public class ConfigLoader {
public Properties loadProperties(String resourceName) {
final InputStream stream = bootstrapServiceRegistry.getService( ClassLoaderService.class ).locateResourceStream( resourceName );
if ( stream == null ) {
throw new ConfigurationException( "Unable to apply settings from properties file [" + resourceName + "]" );
}
try {
Properties properties = new Properties();
properties.load( stream );