Ignore:
Timestamp:
2014-12-21T02:59:09+01:00 (9 years ago)
Author:
Don-vip
Message:

see #10448 - code cleanup, better error message

File:
1 edited

Legend:

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

    r7575 r7869  
    454454                version = Integer.parseInt(versionString);
    455455            } catch(NumberFormatException e) {
    456                 throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.", Long.toString(current.getUniqueId()), versionString), e);
     456                throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.",
     457                        Long.toString(current.getUniqueId()), versionString), e);
    457458            }
    458459            switch (ds.getVersion()) {
    459460            case "0.6":
    460461                if (version <= 0 && !current.isNew()) {
    461                     throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.", Long.toString(current.getUniqueId()), versionString));
     462                    throwException(tr("Illegal value for attribute ''version'' on OSM primitive with ID {0}. Got {1}.",
     463                            Long.toString(current.getUniqueId()), versionString));
    462464                } else if (version < 0 && current.isNew()) {
    463                     Main.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.", current.getUniqueId(), version, 0, "0.6"));
     465                    Main.warn(tr("Normalizing value of attribute ''version'' of element {0} to {2}, API version is ''{3}''. Got {1}.",
     466                            current.getUniqueId(), version, 0, "0.6"));
    464467                    version = 0;
    465468                }
     
    554557            if (getLocation() == null)
    555558                return msg;
    556             msg = msg + " " + tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber());
     559            msg += " " + tr("(at line {0}, column {1})", getLocation().getLineNumber(), getLocation().getColumnNumber());
     560            int offset = getLocation().getCharacterOffset();
     561            if (offset > -1) {
     562                msg += ". "+ tr("{0} bytes have been read", offset);
     563            }
    557564            return msg;
    558565        }
Note: See TracChangeset for help on using the changeset viewer.