- Timestamp:
- 2020-02-26T01:52:17+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/imagery/ImageryInfo.java
r15902 r15934 397 397 min_zoom = i.defaultMinZoom; 398 398 cookies = i.cookies; 399 icon = i .icon == null ? null : i.icon.intern();399 icon = intern(i.icon); 400 400 description = i.description; 401 401 category = i.category != null ? i.category.getCategoryString() : null; … … 555 555 if (e.projections != null && !e.projections.isEmpty()) { 556 556 // split generates null element on empty string which gives one element Array[null] 557 se rverProjections = Arrays.asList(e.projections.split(","));558 } 559 attributionText = e.attribution_text;557 setServerProjections(Arrays.asList(e.projections.split(","))); 558 } 559 attributionText = intern(e.attribution_text); 560 560 attributionLinkURL = e.attribution_url; 561 561 permissionReferenceURL = e.permission_reference_url; … … 567 567 termsOfUseText = e.terms_of_use_text; 568 568 termsOfUseURL = e.terms_of_use_url; 569 countryCode = e.country_code;570 icon = e.icon == null ? null : e.icon.intern();569 countryCode = intern(e.country_code); 570 icon = intern(e.icon); 571 571 if (e.noTileHeaders != null) { 572 572 noTileHeaders = e.noTileHeaders.toMap(); … … 633 633 this.overlay = i.overlay; 634 634 // do not copy field {@code mirrors} 635 this.icon = i .icon == null ? null : i.icon.intern();635 this.icon = intern(i.icon); 636 636 this.isGeoreferenceValid = i.isGeoreferenceValid; 637 637 this.defaultLayers = i.defaultLayers; … … 639 639 this.transparent = i.transparent; 640 640 this.minimumTileExpire = i.minimumTileExpire; 641 this.categoryOriginalString = i .categoryOriginalString;641 this.categoryOriginalString = intern(i.categoryOriginalString); 642 642 this.category = i.category; 643 643 } … … 868 868 */ 869 869 public void setAttributionText(String text) { 870 attributionText = text;870 attributionText = intern(text); 871 871 } 872 872 … … 955 955 956 956 if (serverProjections.isEmpty()) { 957 serverProjections = new ArrayList<>();958 957 Matcher m = Pattern.compile(".*\\{PROJ\\(([^)}]+)\\)\\}.*").matcher(url.toUpperCase(Locale.ENGLISH)); 959 958 if (m.matches()) { 960 for (String p : m.group(1).split(",")) { 961 serverProjections.add(p); 962 } 959 setServerProjections(Arrays.asList(m.group(1).split(","))); 963 960 } 964 961 } … … 1064 1061 if (LanguageInfo.isBetterLanguage(langDescription, language)) { 1065 1062 this.description = isdefault ? tr(description) : description; 1066 this.langDescription = language;1063 this.langDescription = intern(language); 1067 1064 } 1068 1065 } … … 1155 1152 */ 1156 1153 public void setCountryCode(String countryCode) { 1157 this.countryCode = countryCode;1154 this.countryCode = intern(countryCode); 1158 1155 } 1159 1156 … … 1190 1187 */ 1191 1188 public void setIcon(String icon) { 1192 this.icon = i con == null ? null : icon.intern();1189 this.icon = intern(icon); 1193 1190 } 1194 1191 … … 1209 1206 public void setServerProjections(Collection<String> serverProjections) { 1210 1207 CheckParameterUtil.ensureParameterNotNull(serverProjections, "serverProjections"); 1211 this.serverProjections = new ArrayList<>(serverProjections); 1208 this.serverProjections = serverProjections.stream() 1209 .map(String::intern) 1210 .collect(Collectors.collectingAndThen(Collectors.toList(), Utils::toUnmodifiableList)); 1212 1211 } 1213 1212 … … 1355 1354 */ 1356 1355 public void setImageryCategoryOriginalString(String categoryOriginalString) { 1357 this.categoryOriginalString = categoryOriginalString;1356 this.categoryOriginalString = intern(categoryOriginalString); 1358 1357 } 1359 1358 … … 1645 1644 } 1646 1645 } 1646 1647 private static String intern(String string) { 1648 return string == null ? null : string.intern(); 1649 } 1647 1650 } -
trunk/src/org/openstreetmap/josm/data/osm/RelationMember.java
r13766 r15934 84 84 public RelationMember(String role, OsmPrimitive member) { 85 85 CheckParameterUtil.ensureParameterNotNull(member, "member"); 86 this.role = Optional.ofNullable(role).orElse("") ;86 this.role = Optional.ofNullable(role).orElse("").intern(); 87 87 this.member = member; 88 88 } -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/ConditionFactory.java
r15671 r15934 259 259 */ 260 260 public SimpleKeyValueCondition(String k, String v) { 261 this.k = k ;262 this.v = v ;261 this.k = k.intern(); 262 this.v = v.intern(); 263 263 } 264 264 … … 311 311 */ 312 312 public KeyValueCondition(String k, String v, Op op, boolean considerValAsKey) { 313 this.k = k ;314 this.v = v ;313 this.k = k.intern(); 314 this.v = v.intern(); 315 315 this.op = op; 316 316 this.considerValAsKey = considerValAsKey; -
trunk/src/org/openstreetmap/josm/gui/mappaint/mapcss/LiteralExpression.java
r14484 r15934 20 20 public LiteralExpression(Object literal) { 21 21 CheckParameterUtil.ensureParameterNotNull(literal); 22 this.literal = literal ;22 this.literal = literal instanceof String ? ((String) literal).intern() : literal; 23 23 } 24 24
Note:
See TracChangeset
for help on using the changeset viewer.