activityworkshop / GpsPrune

GpsPrune is a map-based application for viewing, editing and converting coordinate data from GPS systems.
GNU General Public License v2.0
68 stars 21 forks source link

GpsPrune fails to export multiple loaded GPX-files #65

Closed dumbenis closed 1 year ago

dumbenis commented 1 year ago

Loaded multiple GPX-files and removed duplicate points succesfully. Export of GPX fails.

Exception in thread "Thread-606" java.lang.NullPointerException: Cannot invoke "tim.prune.data.DataPoint.isWaypoint()" because "" is null at tim.prune.save.GpxExporter.writeTrackPoints(Unknown Source) at tim.prune.save.GpxExporter.exportData(Unknown Source) at tim.prune.save.GpxExporter.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

activityworkshop commented 1 year ago

Hi, and thanks for reporting the problem. It seems like you have found a way to set one of the DataPoints to "null", which of course normally shouldn't be possible.

Unfortunately it's not quite so simple to reproduce, so there must be another step which you're doing, which may not even seem important.

For example, I can load these multiple gpx files (after unpacking from this zip file) (52 points), delete the duplicates with the "Track -> Compress" function (deleting 3 duplicates) and then export the result as a new gpx (containing 49 points). This is all completely normal and has worked for years.

bytheriver.zip

Could it be that you're exporting the result to one of the files which you're using as a source? Could you then please also try the same process but exporting to a new file?

dumbenis commented 1 year ago

First, thank you for your reply.

1. I imported the 3 GPX-files from BYTHERIVER, deleted duplicates and exported them to a new single GPX-file. No problem observed.

2. I repeat what I did: I import 1 GPX-files with 758.970 points in GpsPrune. That works fine.

2. Deleting duplicates: 483.898 points left.

3. Exporting to GPX-file. No output. Nothing seems to happen. Still I see the "Export GPX" window. To get this window away, I press cancel.

4. So, I start all over with a new attempt by opening the same GPX-file. Then to error occurs: Exception in thread "Thread-571" java.lang.NullPointerException: Cannot invoke "tim.prune.data.DataPoint.isWaypoint()" because "" is null at tim.prune.save.GpxExporter.writeTrackPoints(Unknown Source) at tim.prune.save.GpxExporter.exportData(Unknown Source) at tim.prune.save.GpxExporter.run(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

5. In fact, GpsPrune is busy in the background secretly exporting the large GPX-file. So, while exporting the GPX-file in secret, I load a GPX-file and create the error message.

6. When I wait until the GPX-export is filled, the Export GPX window disappears.

7. I thing you now know what the solution is: prevent GpsPrune from loading a GPX-file while exporting a GPX-file at the same time and keeping the user informed about the progress of the export.

Regards,

Dumbenis

activityworkshop commented 1 year ago

Thanks a lot for doing the detective work on this one :) thanks, that's great. So the problem wasn't the merging of the files or the duplicate deletion, but the behaviour of the export (and the cancel) when the export takes a long time.

The fixes for this will come with version 23, and as you said they come in several parts:

There isn't a release date for 23 yet, but it will certainly be next year.

dumbenis commented 1 year ago

I was happy to help you in improving your program. Good luck with the new versions.

activityworkshop commented 1 year ago

done :)