Changeset 5840 in josm


Ignore:
Timestamp:
2013-04-11T20:01:30+02:00 (12 years ago)
Author:
Don-vip
Message:

see #8571, #8593 - Hide values of proxy VM arguments for privacy concerns

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java

    r5833 r5840  
    99import java.awt.event.KeyEvent;
    1010import java.lang.management.ManagementFactory;
     11import java.util.ArrayList;
    1112import java.util.Arrays;
    1213import java.util.HashSet;
    1314import java.util.List;
     15import java.util.ListIterator;
    1416import java.util.Map;
    1517import java.util.Map.Entry;
     
    2931import org.openstreetmap.josm.tools.Utils;
    3032
    31 
    3233/**
    3334 * @author xeen
     
    3738 */
    3839public final class ShowStatusReportAction extends JosmAction {
     40   
     41    /**
     42     * Constructs a new {@code ShowStatusReportAction}
     43     */
    3944    public ShowStatusReportAction() {
    4045        super(
     
    7075        text.append("\n");
    7176        try {
    72             List<String> vmArguments = ManagementFactory.getRuntimeMXBean().getInputArguments();
     77            // Build a new list of VM parameters to modify it below if needed (default implementation returns an UnmodifiableList instance)
     78            List<String> vmArguments = new ArrayList<String>(ManagementFactory.getRuntimeMXBean().getInputArguments());
     79            // Hide some parameters for privacy concerns
     80            for (ListIterator<String> it = vmArguments.listIterator(); it.hasNext(); ) {
     81                String value = it.next();
     82                if (value.contains("=") && value.toLowerCase().startsWith("-dproxy")) {
     83                    it.set(value.split("=")[0]+"=xxx");
     84                }
     85            }
    7386            if (!vmArguments.isEmpty()) {
    7487                text.append("VM arguments: "+ vmArguments.toString().replace("\\\\", "\\"));
Note: See TracChangeset for help on using the changeset viewer.