Changeset 16579 in josm for trunk/src/org


Ignore:
Timestamp:
2020-06-08T21:53:03+02:00 (4 years ago)
Author:
simon04
Message:

fix #19058 - Corrupt line "imagery.entries" in status report

File:
1 edited

Legend:

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

    r16535 r16579  
    277277    }
    278278
     279    private static String valueCleanup(Object value) {
     280        String valueString = value.toString();
     281        if (valueString.length() > 512 && value instanceof Collection<?>) {
     282            valueString = ((Collection<?>) value).stream().map(v -> {
     283                if (v instanceof Map<?, ?>) {
     284                    LinkedHashMap<Object, Object> map = new LinkedHashMap<>(((Map<?, ?>) v));
     285                    map.computeIfPresent("icon", (k, icon) -> Utils.shortenString(icon.toString(), 32)); // see #19058
     286                    return map.toString();
     287                } else {
     288                    return String.valueOf(v);
     289                }
     290            }).collect(Collectors.joining(",\n  ", "[", "\n]"));
     291        }
     292        return paramCleanup(valueString);
     293    }
     294
    279295    @Override
    280296    public void actionPerformed(ActionEvent e) {
     
    295311            text.append(paramCleanup(key))
    296312                    .append('=')
    297                     .append(paramCleanup(setting.getValue().toString()))
     313                    .append(valueCleanup(setting.getValue()))
    298314                    .append('\n');
    299315        });
Note: See TracChangeset for help on using the changeset viewer.