Changeset 6117 in josm


Ignore:
Timestamp:
2013-08-07T22:11:35+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8941 - display gpx parsing error on stderr

File:
1 edited

Legend:

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

    r6080 r6117  
    2020import javax.xml.parsers.SAXParserFactory;
    2121
     22import org.openstreetmap.josm.Main;
    2223import org.openstreetmap.josm.data.coor.LatLon;
    2324import org.openstreetmap.josm.data.gpx.Extensions;
     
    3132import org.xml.sax.InputSource;
    3233import org.xml.sax.SAXException;
     34import org.xml.sax.SAXParseException;
    3335import org.xml.sax.helpers.DefaultHandler;
    3436
     
    406408                GpxLink link = new GpxLink(url);
    407409                link.text = urlname;
    408                 @SuppressWarnings("unchecked")
     410                @SuppressWarnings({ "unchecked", "rawtypes" })
    409411                Collection<GpxLink> links = (Collection) attr.get(META_LINKS);
    410412                links.add(link);
     
    455457                if (parser.data.isEmpty())
    456458                    throw e;
     459                String message = e.getMessage();
     460                if (e instanceof SAXParseException) {
     461                    SAXParseException spe = ((SAXParseException)e);
     462                    message += " " + tr("(at line {0}, column {1})", spe.getLineNumber(), spe.getColumnNumber());
     463                }
     464                Main.warn(message);
    457465                return false;
    458466            } else
     
    464472    }
    465473
     474    /**
     475     * Replies the GPX data.
     476     * @return The GPX data
     477     */
    466478    public GpxData getGpxData() {
    467479        return gpxData;
Note: See TracChangeset for help on using the changeset viewer.