Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ public final class Environment implements AvailableSettings {
InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" );
try {
GLOBAL_PROPERTIES.load(stream);
LOG.propertiesLoaded( ConfigurationHelper.maskOut( GLOBAL_PROPERTIES, PASS ) );
LOG.propertiesLoaded( ConfigurationHelper.maskOut( GLOBAL_PROPERTIES,
PASS, JAKARTA_JDBC_PASSWORD, JPA_JDBC_PASSWORD ) );
}
catch (Exception e) {
LOG.unableToLoadProperties();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ else if ( configurationValues instanceof Properties properties ) {
}

/**
* replace a property by a starred version
* Replace a property by a starred version
*
* @param props properties to check
* @param key property to mask
Expand All @@ -285,6 +285,24 @@ public static Properties maskOut(Properties props, String key) {
return clone;
}

/**
* Replace properties by starred version
*
* @param props properties to check
* @param keys properties to mask
*
* @return cloned and masked properties
*/
public static Properties maskOut(Properties props, String... keys) {
final Properties clone = (Properties) props.clone();
for ( String key : keys ) {
if ( clone.get( key ) != null ) {
clone.setProperty( key, "****" );
}
}
return clone;
}

/**
* Extract a property value by name from the given properties object.
* <p>
Expand Down