void (@NotNull Map<String, String> envs) { List<Pair<String, String>> reserved = ContainerUtil.mapNotNull(envs.entrySet(), entry -> { if (entry.getKey().startsWith(RESERVED_ORIGINAL_VARIABLE_PREFIX)) { return new Pair<>(entry.getKey(), entry.getValue()); } return null; }); for (Pair<String, String> pair : reserved) { String originalName = pair.first.substring(RESERVED_ORIGINAL_VARIABLE_PREFIX.length()); if (originalName.length() == 0) { Logger.getInstance(EnvironmentRestorer.class).warn( "the name of the reserved environment variable consists only of the prefix \"" + RESERVED_ORIGINAL_VARIABLE_PREFIX + "\". name=" + pair.first + " value=" + pair.second); continue; } envs.remove(pair.first); if (StringUtil.isNotEmpty(pair.second)) { envs.put(originalName, pair.second); } else { envs.remove(originalName); // we assume that an empty value means no value (GTW-335) } } }