Changeset 17521 in josm
- Timestamp:
- 2021-02-22T00:40:49+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r17339 r17521 20 20 import java.util.Collections; 21 21 import java.util.HashMap; 22 import java.util.LinkedHashSet; 22 23 import java.util.List; 23 24 import java.util.Locale; … … 25 26 import java.util.Map.Entry; 26 27 import java.util.Optional; 28 import java.util.Set; 27 29 import java.util.stream.Collectors; 28 30 … … 345 347 */ 346 348 private static String getCommentWithDataSetHashTag(String comment, DataSet dataSet) { 347 String result = comment;349 StringBuilder result = new StringBuilder(comment); 348 350 if (dataSet != null) { 349 351 String hashtags = dataSet.getChangeSetTags().get("hashtags"); 350 352 if (hashtags != null) { 353 Set<String> sanitizedHashtags = new LinkedHashSet<>(); 351 354 for (String hashtag : hashtags.split(";", -1)) { 352 String sanitizedHashtag = hashtag.startsWith("#") ? hashtag : "#" + hashtag; 353 if (!result.contains(sanitizedHashtag)) { 354 result = result + " " + sanitizedHashtag; 355 } 355 sanitizedHashtags.add(hashtag.startsWith("#") ? hashtag : "#" + hashtag); 356 356 } 357 } 358 } 359 return result; 357 if (!sanitizedHashtags.isEmpty()) { 358 result.append(' ').append(String.join(" ", sanitizedHashtags)); 359 } 360 } 361 } 362 return result.toString(); 360 363 } 361 364
Note:
See TracChangeset
for help on using the changeset viewer.