HHH-9689 Avoid NPE when trying to load non-existent properties resource
This commit is contained in:
parent
1f50efa34c
commit
30240beded
|
@ -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 );
|
||||
|
|
Loading…
Reference in New Issue