Changeset 13414 in josm
- Timestamp:
- 2018-02-12T02:31:14+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/upload/ApiPreconditionCheckerHook.java
r12636 r13414 12 12 import org.openstreetmap.josm.data.APIDataSet; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 import org.openstreetmap.josm.data.osm.Tagged; 14 15 import org.openstreetmap.josm.data.osm.Way; 15 16 import org.openstreetmap.josm.gui.ExceptionDialogUtil; … … 61 62 for (String key: osmPrimitive.keySet()) { 62 63 String value = osmPrimitive.get(key); 63 if (key.length() > 255) {64 if (key.length() > Tagged.MAX_TAG_LENGTH) { 64 65 if (osmPrimitive.isDeleted()) { 65 66 // if OsmPrimitive is going to be deleted we automatically shorten the value … … 70 71 ) 71 72 ); 72 osmPrimitive.put(key, value.substring(0, 255));73 osmPrimitive.put(key, value.substring(0, Tagged.MAX_TAG_LENGTH)); 73 74 continue; 74 75 } 75 76 JOptionPane.showMessageDialog(Main.parent, 76 77 tr("Length of value for tag ''{0}'' on object {1} exceeds the max. allowed length {2}. Values length is {3}.", 77 key, Long.toString(osmPrimitive.getId()), 255, value.length()78 key, Long.toString(osmPrimitive.getId()), Tagged.MAX_TAG_LENGTH, value.length() 78 79 ), 79 80 tr("Precondition Violation"), -
trunk/src/org/openstreetmap/josm/data/osm/Changeset.java
r13173 r13414 25 25 26 26 /** The maximum changeset tag length allowed by API 0.6 **/ 27 public static final int MAX_CHANGESET_TAG_LENGTH = 255;27 public static final int MAX_CHANGESET_TAG_LENGTH = MAX_TAG_LENGTH; 28 28 29 29 /** the changeset id */ -
trunk/src/org/openstreetmap/josm/data/osm/Tagged.java
r11608 r13414 13 13 // 14 14 public interface Tagged { 15 16 /** 17 * The maximum tag length allowed by OSM API 18 * @since 13414 19 */ 20 int MAX_TAG_LENGTH = 255; 21 15 22 /** 16 23 * Sets the map of key/value pairs -
trunk/src/org/openstreetmap/josm/data/validation/tests/TagChecker.java
r13246 r13414 34 34 import org.openstreetmap.josm.data.osm.OsmUtils; 35 35 import org.openstreetmap.josm.data.osm.Tag; 36 import org.openstreetmap.josm.data.osm.Tagged; 36 37 import org.openstreetmap.josm.data.preferences.sources.ValidatorPrefHelper; 37 38 import org.openstreetmap.josm.data.validation.Severity; … … 447 448 withErrors.put(p, "ICK"); 448 449 } 449 if (checkValues && (value != null && value.length() > 255) && !withErrors.contains(p, "LV")) {450 if (checkValues && (value != null && value.length() > Tagged.MAX_TAG_LENGTH) && !withErrors.contains(p, "LV")) { 450 451 errors.add(TestError.builder(this, Severity.ERROR, LONG_VALUE) 451 .message(tr("Tag value longer than allowed"), s, key)452 .message(tr("Tag value longer than {0} characters ({1} characters)", Tagged.MAX_TAG_LENGTH, value.length()), s, key) 452 453 .primitives(p) 453 454 .build()); 454 455 withErrors.put(p, "LV"); 455 456 } 456 if (checkKeys && (key != null && key.length() > 255) && !withErrors.contains(p, "LK")) {457 if (checkKeys && (key != null && key.length() > Tagged.MAX_TAG_LENGTH) && !withErrors.contains(p, "LK")) { 457 458 errors.add(TestError.builder(this, Severity.ERROR, LONG_KEY) 458 .message(tr("Tag key longer than allowed"), s, key)459 .message(tr("Tag key longer than {0} characters ({1} characters)", Tagged.MAX_TAG_LENGTH, key.length()), s, key) 459 460 .primitives(p) 460 461 .build());
Note:
See TracChangeset
for help on using the changeset viewer.