HHH-13047 Deprecate Environment#verifyProperties

This commit is contained in:
Sanne Grinovero 2018-10-16 16:36:48 +01:00
parent 1fb77629e2
commit aae9cd14a5
6 changed files with 4 additions and 30 deletions

View File

@ -281,7 +281,6 @@ public class StandardServiceRegistryBuilder {
final Map settingsCopy = new HashMap(); final Map settingsCopy = new HashMap();
settingsCopy.putAll( settings ); settingsCopy.putAll( settings );
settingsCopy.put( org.hibernate.boot.cfgxml.spi.CfgXmlAccessService.LOADED_CONFIG_KEY, aggregatedCfgXml ); settingsCopy.put( org.hibernate.boot.cfgxml.spi.CfgXmlAccessService.LOADED_CONFIG_KEY, aggregatedCfgXml );
Environment.verifyProperties( settingsCopy );
ConfigurationHelper.resolvePlaceHolders( settingsCopy ); ConfigurationHelper.resolvePlaceHolders( settingsCopy );
return new StandardServiceRegistryImpl( return new StandardServiceRegistryImpl(

View File

@ -8,7 +8,6 @@ package org.hibernate.cfg;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Properties; import java.util.Properties;
@ -160,28 +159,15 @@ public final class Environment implements AvailableSettings {
private static final Properties GLOBAL_PROPERTIES; private static final Properties GLOBAL_PROPERTIES;
private static final Map OBSOLETE_PROPERTIES = new HashMap();
private static final Map RENAMED_PROPERTIES = new HashMap();
/** /**
* Issues warnings to the user when any obsolete or renamed property names are used. * No longer effective.
* *
* @param configurationValues The specified properties. * @param configurationValues The specified properties.
* @deprecated without replacement. Such verification is best done ad hoc, case by case.
*/ */
@Deprecated
public static void verifyProperties(Map<?,?> configurationValues) { public static void verifyProperties(Map<?,?> configurationValues) {
final Map propertiesToAdd = new HashMap(); //Obsolete and Renamed properties are no longer handled here
for ( Map.Entry entry : configurationValues.entrySet() ) {
final Object replacementKey = OBSOLETE_PROPERTIES.get( entry.getKey() );
if ( replacementKey != null ) {
LOG.unsupportedProperty( entry.getKey(), replacementKey );
}
final Object renamedKey = RENAMED_PROPERTIES.get( entry.getKey() );
if ( renamedKey != null ) {
LOG.renamedProperty( entry.getKey(), renamedKey );
propertiesToAdd.put( renamedKey, entry.getValue() );
}
}
configurationValues.putAll( propertiesToAdd );
} }
static { static {
@ -225,8 +211,6 @@ public final class Environment implements AvailableSettings {
LOG.unableToCopySystemProperties(); LOG.unableToCopySystemProperties();
} }
verifyProperties(GLOBAL_PROPERTIES);
ENABLE_BINARY_STREAMS = ConfigurationHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES); ENABLE_BINARY_STREAMS = ConfigurationHelper.getBoolean(USE_STREAMS_FOR_BINARY, GLOBAL_PROPERTIES);
if ( ENABLE_BINARY_STREAMS ) { if ( ENABLE_BINARY_STREAMS ) {
LOG.usingStreams(); LOG.usingStreams();

View File

@ -1397,12 +1397,6 @@ public interface CoreMessageLogger extends BasicLogger {
@Message(value = "Oracle 11g is not yet fully supported; using Oracle 10g dialect", id = 394) @Message(value = "Oracle 11g is not yet fully supported; using Oracle 10g dialect", id = 394)
void unsupportedOracleVersion(); void unsupportedOracleVersion();
@LogMessage(level = WARN)
@Message(value = "Usage of obsolete property: %s no longer supported, use: %s", id = 395)
void unsupportedProperty(
Object propertyName,
Object newPropertyName);
@LogMessage(level = INFO) @LogMessage(level = INFO)
@Message(value = "Updating schema", id = 396) @Message(value = "Updating schema", id = 396)
void updatingSchema(); void updatingSchema();

View File

@ -49,7 +49,6 @@ class ManagedProviderConnectionHelper implements ConnectionHelper {
} }
private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) { private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) {
Environment.verifyProperties( properties );
ConfigurationHelper.resolvePlaceHolders( properties ); ConfigurationHelper.resolvePlaceHolders( properties );
return (StandardServiceRegistryImpl) new StandardServiceRegistryBuilder().applySettings( properties ).build(); return (StandardServiceRegistryImpl) new StandardServiceRegistryBuilder().applySettings( properties ).build();
} }

View File

@ -254,7 +254,6 @@ public abstract class BaseJpaOrNativeBootstrapFunctionalTestCase extends BaseUni
private StandardServiceRegistryImpl buildServiceRegistry(BootstrapServiceRegistry bootRegistry, Configuration configuration) { private StandardServiceRegistryImpl buildServiceRegistry(BootstrapServiceRegistry bootRegistry, Configuration configuration) {
Properties properties = new Properties(); Properties properties = new Properties();
properties.putAll( configuration.getProperties() ); properties.putAll( configuration.getProperties() );
Environment.verifyProperties( properties );
ConfigurationHelper.resolvePlaceHolders( properties ); ConfigurationHelper.resolvePlaceHolders( properties );
StandardServiceRegistryBuilder cfgRegistryBuilder = configuration.getStandardServiceRegistryBuilder(); StandardServiceRegistryBuilder cfgRegistryBuilder = configuration.getStandardServiceRegistryBuilder();

View File

@ -267,7 +267,6 @@ public abstract class BaseCoreFunctionalTestCase extends BaseUnitTestCase {
protected StandardServiceRegistryImpl buildServiceRegistry(BootstrapServiceRegistry bootRegistry, Configuration configuration) { protected StandardServiceRegistryImpl buildServiceRegistry(BootstrapServiceRegistry bootRegistry, Configuration configuration) {
Properties properties = new Properties(); Properties properties = new Properties();
properties.putAll( configuration.getProperties() ); properties.putAll( configuration.getProperties() );
Environment.verifyProperties( properties );
ConfigurationHelper.resolvePlaceHolders( properties ); ConfigurationHelper.resolvePlaceHolders( properties );
StandardServiceRegistryBuilder cfgRegistryBuilder = configuration.getStandardServiceRegistryBuilder(); StandardServiceRegistryBuilder cfgRegistryBuilder = configuration.getStandardServiceRegistryBuilder();