Here you can find the source of maskApplicationEnvProperties(Map
static Map<String, String> maskApplicationEnvProperties(Map<String, String> environmentVariables,
Set<String> variablesToMask)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { static Map<String, String> maskApplicationEnvProperties(Map<String, String> environmentVariables, Set<String> variablesToMask) { HashMap<String, String> masked = new HashMap<>(); for (String variableKey : environmentVariables.keySet()) { if (variablesToMask.contains(variableKey)) { masked.put(variableKey, maskEnvironmentVariable(environmentVariables.get(variableKey))); } else { masked.put(variableKey, environmentVariables.get(variableKey)); }/*from ww w . ja va 2s .c om*/ } return masked; } private static String maskEnvironmentVariable(String variableValue) { if (variableValue == null || variableValue.length() < 5) { // We assume short variable values are not sensitive return variableValue; } return variableValue.substring(0, 2) + "..." + variableValue.substring(variableValue.length() - 2, variableValue.length()); } }