HHH-8383 ExceptionInInitializerError when changing System properties
while Environment class is initialized
This commit is contained in:
parent
4f2088856f
commit
b1759cb7c2
|
@ -32,14 +32,13 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
|
||||||
|
|
||||||
import org.hibernate.HibernateException;
|
import org.hibernate.HibernateException;
|
||||||
import org.hibernate.Version;
|
import org.hibernate.Version;
|
||||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
import org.hibernate.internal.util.ConfigHelper;
|
import org.hibernate.internal.util.ConfigHelper;
|
||||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||||
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -240,10 +239,14 @@ public final class Environment implements AvailableSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
GLOBAL_PROPERTIES.putAll( System.getProperties() );
|
Properties systemProperties = System.getProperties();
|
||||||
}
|
// Must be thread-safe in case an application changes System properties during Hibernate initialization.
|
||||||
catch (SecurityException se) {
|
// See HHH-8383.
|
||||||
LOG.unableToCopySystemProperties();
|
synchronized (systemProperties) {
|
||||||
|
GLOBAL_PROPERTIES.putAll(systemProperties);
|
||||||
|
}
|
||||||
|
} catch (SecurityException se) {
|
||||||
|
LOG.unableToCopySystemProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyProperties(GLOBAL_PROPERTIES);
|
verifyProperties(GLOBAL_PROPERTIES);
|
||||||
|
|
Loading…
Reference in New Issue