Changeset 19670 in josm


Ignore:
Timestamp:
2026-11-01T20:24:29+01:00 (less than one hour ago)
Author:
gaben
Message:

fix #24989 - crash when adding an imagery with the same HTTP header name twice

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/imagery/HeadersTable.java

    r19519 r19670  
    55
    66import java.awt.GridBagLayout;
     7import java.util.LinkedHashMap;
    78import java.util.List;
    89import java.util.Map;
    … …  
    1718
    1819import org.openstreetmap.josm.tools.GBC;
     20import org.openstreetmap.josm.tools.Utils;
    1921
    2022/**
    … …  
    112114    /**
    113115     * Returns headers provided by user.
    114      * @return headers provided by user
     116     * Rows without a name or without a value are ignored. If several rows use the same name, the last one wins.
     117     * @return headers provided by user, in table order
    115118     */
    116119    public Map<String, String> getHeaders() {
    117         return headers.stream().distinct().collect(Collectors.toMap(x -> x[0], x -> x[1]));
     120        Map<String, String> result = new LinkedHashMap<>();
     121        for (String[] header : headers) {
     122            if (!Utils.isStripEmpty(header[0]) && !Utils.isStripEmpty(header[1])) {
     123                result.put(header[0], header[1]);
     124            }
     125        }
     126        return result;
    118127    }
    119128
Note: See TracChangeset for help on using the changeset viewer.