Ignore:
Timestamp:
2018-04-04T19:47:35+02:00 (20 months ago)
Author:
Don-vip
Message:

fix #16145 - remove white spaces from key/values when pasting tags

Location:
trunk/src/org/openstreetmap/josm/data
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/Tag.java

    r10737 r13597  
    145145     * @return The string without leading, trailing or multiple inner whitespaces
    146146     * @since 6699
    147      */
     147     * @deprecated since 13597. Use {@link Utils#removeWhiteSpaces(String)} instead
     148     */
     149    @Deprecated
    148150    public static String removeWhiteSpaces(String s) {
    149         if (s == null || s.isEmpty()) {
    150             return s;
    151         }
    152         return Utils.strip(s).replaceAll("\\s+", " ");
     151        return Utils.removeWhiteSpaces(s);
    153152    }
    154153
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r13507 r13597  
    336336                            CheckParameterUtil.ensureThat(val.contains("=>"), "Separate old from new key by '=>'!");
    337337                            final String[] x = val.split("=>", 2);
    338                             check.fixCommands.add(FixCommand.fixChangeKey(Tag.removeWhiteSpaces(x[0]), Tag.removeWhiteSpaces(x[1])));
     338                            check.fixCommands.add(FixCommand.fixChangeKey(Utils.removeWhiteSpaces(x[0]), Utils.removeWhiteSpaces(x[1])));
    339339                        } else if (val != null && "fixDeleteObject".equals(ai.key)) {
    340340                            CheckParameterUtil.ensureThat("this".equals(val), "fixDeleteObject must be followed by 'this'");
  • trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java

    r13584 r13597  
    710710                    commands.add(new ChangePropertyCommand(p, key, null));
    711711                } else if (value.startsWith(" ") || value.endsWith(" ") || value.contains("  ")) {
    712                     commands.add(new ChangePropertyCommand(p, key, Tag.removeWhiteSpaces(value)));
     712                    commands.add(new ChangePropertyCommand(p, key, Utils.removeWhiteSpaces(value)));
    713713                } else if (key.startsWith(" ") || key.endsWith(" ") || key.contains("  ")) {
    714                     commands.add(new ChangePropertyKeyCommand(p, key, Tag.removeWhiteSpaces(key)));
     714                    commands.add(new ChangePropertyKeyCommand(p, key, Utils.removeWhiteSpaces(key)));
    715715                } else {
    716716                    String evalue = Entities.unescape(value);
Note: See TracChangeset for help on using the changeset viewer.