Ignore:
Timestamp:
2018-02-12T02:31:14+01:00 (22 months ago)
Author:
Don-vip
Message:

fix #15452 - More details are needed for "Tag value longer than allowed" (patch by Klumbumbus, modified)

File:
1 edited

Legend:

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

    r12636 r13414  
    1212import org.openstreetmap.josm.data.APIDataSet;
    1313import org.openstreetmap.josm.data.osm.OsmPrimitive;
     14import org.openstreetmap.josm.data.osm.Tagged;
    1415import org.openstreetmap.josm.data.osm.Way;
    1516import org.openstreetmap.josm.gui.ExceptionDialogUtil;
     
    6162            for (String key: osmPrimitive.keySet()) {
    6263                String value = osmPrimitive.get(key);
    63                 if (key.length() > 255) {
     64                if (key.length() > Tagged.MAX_TAG_LENGTH) {
    6465                    if (osmPrimitive.isDeleted()) {
    6566                        // if OsmPrimitive is going to be deleted we automatically shorten the value
     
    7071                                )
    7172                        );
    72                         osmPrimitive.put(key, value.substring(0, 255));
     73                        osmPrimitive.put(key, value.substring(0, Tagged.MAX_TAG_LENGTH));
    7374                        continue;
    7475                    }
    7576                    JOptionPane.showMessageDialog(Main.parent,
    7677                            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()
    7879                            ),
    7980                            tr("Precondition Violation"),
Note: See TracChangeset for help on using the changeset viewer.