Changeset 5561 in josm


Ignore:
Timestamp:
2012-11-04T00:57:22+01:00 (11 years ago)
Author:
Don-vip
Message:

fix #8145 - Forbids negative values in object id field of download object dialog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/widgets/OsmIdTextField.java

    r5354 r5561  
    1414import org.openstreetmap.josm.data.osm.PrimitiveId;
    1515import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
    16 import org.openstreetmap.josm.tools.Utils;
    1716
    1817/**
     
    104103                    } catch (IllegalArgumentException ex) {
    105104                        try {
    106                             if (type == OsmPrimitiveType.NODE) {
    107                                 ids.add(new SimplePrimitiveId(Long.parseLong(s), OsmPrimitiveType.NODE));
     105                            long id = Long.parseLong(s);
     106                            if (id <= 0) {
     107                                return false;
     108                            } else if (type == OsmPrimitiveType.NODE) {
     109                                ids.add(new SimplePrimitiveId(id, OsmPrimitiveType.NODE));
    108110                            } else if (type == OsmPrimitiveType.WAY) {
    109                                 ids.add(new SimplePrimitiveId(Long.parseLong(s), OsmPrimitiveType.WAY));
     111                                ids.add(new SimplePrimitiveId(id, OsmPrimitiveType.WAY));
    110112                            } else if (type == OsmPrimitiveType.RELATION) {
    111                                 ids.add(new SimplePrimitiveId(Long.parseLong(s), OsmPrimitiveType.RELATION));
     113                                ids.add(new SimplePrimitiveId(id, OsmPrimitiveType.RELATION));
    112114                            } else {
    113115                                return false;
Note: See TracChangeset for help on using the changeset viewer.