Changeset 7869 in josm for trunk/src


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

see #10448 - code cleanup, better error message

Location:
trunk/src/org/openstreetmap/josm
Files:
2 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        }
  • trunk/src/org/openstreetmap/josm/tools/Utils.java

    r7867 r7869  
    1313import java.awt.datatransfer.Transferable;
    1414import java.awt.datatransfer.UnsupportedFlavorException;
    15 import java.io.BufferedInputStream;
    1615import java.io.BufferedReader;
    1716import java.io.Closeable;
     
    763762            return null;
    764763        }
    765         BufferedInputStream bis = new BufferedInputStream(in);
    766         return new BZip2CompressorInputStream(bis, /* see #9537 */ true);
     764        return new BZip2CompressorInputStream(in, /* see #9537 */ true);
    767765    }
    768766
Note: See TracChangeset for help on using the changeset viewer.