Modify

Opened 11 years ago

Closed 11 years ago

#633 closed defect (fixed)

Cannot open GPX file

Reported by: me@… Owned by: framm
Priority: major Milestone:
Component: Core Version:
Keywords: Cc:

Description

Path: josm
URL: http://www.openstreetmap.de/svn/josm
Repository Root: http://www.openstreetmap.de/svn/josm
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Revision: 566
Node Kind: directory
Last Changed Author: david
Last Changed Rev: 566
Last Changed Date: 2008-02-26 15:16:52 +0100 (Tue, 26 Feb 2008)

java.lang.NullPointerException

at org.openstreetmap.josm.data.gpx.WayPoint.setTime(WayPoint.java:41)
at org.openstreetmap.josm.io.GpxReader$Parser.endElement(GpxReader.java:236)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.parse(Unknown Source)
at org.openstreetmap.josm.io.GpxReader.<init>(GpxReader.java:304)
at org.openstreetmap.josm.actions.OpenAction.openFileAsGpx(OpenAction.java:88)
at org.openstreetmap.josm.actions.OpenAction.openFile(OpenAction.java:57)
at org.openstreetmap.josm.actions.OpenAction.actionPerformed(OpenAction.java:48)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

I have attached the offending GPX file. It was genereated from DNRGarmin.

Attachments (1)

blah.gpx (26.3 KB) - added by me@… 11 years ago.
offending gpx file

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by me@…

Attachment: blah.gpx added

offending gpx file

comment:1 Changed 11 years ago by ramack

I do not get a NullPointerException, but the code is obviously wrong here. Could you try to apply the following patch:

Index: src/org/openstreetmap/josm/data/gpx/WayPoint.java
===================================================================
--- src/org/openstreetmap/josm/data/gpx/WayPoint.java   (Revision 569)
+++ src/org/openstreetmap/josm/data/gpx/WayPoint.java   (Arbeitskopie)
@@ -36,9 +36,11 @@
                        time = 0.0;
                SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); // ignore timezone
                Date d = f.parse(attr.get("time").toString(), new ParsePosition(0));
-               if (d == null /* failed to parse */)
+               if (d == null /* failed to parse */){
                        time = 0.0;
-               time = d.getTime() / 1000.0; /* ms => seconds */
+               }else{
+                       time = d.getTime() / 1000.0; /* ms => seconds */
+               }
        }

 }

comment:2 Changed 11 years ago by tom_evans_a@…

Resolution: fixed
Status: newclosed

Fixed in r571, now works for me.

Fixed as ramack said, but also for the time = 0.0 higher up too.
Looks like an accident when David was rearranging his new audio stuff in r553.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain framm.
as The resolution will be set.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.