Changeset 2089 in josm for trunk


Ignore:
Timestamp:
2009-09-09T20:12:04+02:00 (15 years ago)
Author:
Gubaer
Message:

see #3443: Illegal value for attribute 'version' when loading OSM file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r2086 r2089  
    395395                    throwException(tr("Illegal value for attribute ''version'' on OSM primitive with id {0}. Got {1}", Long.toString(current.id), version));
    396396                }
    397                 if (current.version <= 0 && current.id > 0) {
    398                     throwException(tr("Illegal value for attribute ''version'' on OSM primitive with id {0}. Got {1}", Long.toString(current.id), version));
    399                 } else if (current.version < 0 && current.id  <=0) {
    400                     System.out.println(tr("WARNING: normalizing value of attribute ''version'' of element {0} to 0. Got {1}", current.id, current.version));
    401                     current.version = 0;
     397                if (ds.version.equals("0.6")){
     398                    if (current.version <= 0 && current.id > 0) {
     399                        throwException(tr("Illegal value for attribute ''version'' on OSM primitive with id {0}. Got {1}", Long.toString(current.id), version));
     400                    } else if (current.version < 0 && current.id  <=0) {
     401                        System.out.println(tr("WARNING: normalizing value of attribute ''version'' of element {0} to 0, API version is ''0.6''. Got {1}", current.id, current.version));
     402                        current.version = 0;
     403                    }
     404                } else if (ds.version.equals("0.5")) {
     405                    if (current.version <= 0 && current.id > 0) {
     406                        System.out.println(tr("WARNING: normalizing value of attribute ''version'' of element {0} to 1, API version is ''0.5''. Got {1}", current.id, current.version));
     407                        current.version = 1;
     408                    } else if (current.version < 0 && current.id  <=0) {
     409                        System.out.println(tr("WARNING: normalizing value of attribute ''version'' of element {0} to 0, API version is ''0.5''. Got {1}", current.id, current.version));
     410                        current.version = 0;
     411                    }
     412                } else {
     413                    // should not happen. API version has been checked before
     414                    throwException(tr("Unknown or unsupported API version. Got {0}", ds.version));
    402415                }
    403416            } else {
Note: See TracChangeset for help on using the changeset viewer.