Opened 3 years ago

Closed 7 months ago

#19474 closed defect (fixed)

pt_assistant crashes when using validator on certain bus routes

Reported by: max.walder@… Owned by: max.walder@…
Priority: normal Milestone:
Component: Plugin pt_assistant Version:
Keywords: validation crash Cc: michael2402, floscher, Polyglot


What steps will reproduce the problem?

  1. download a bus route where some platforms are mapped as ways (such as ) and all relation members
  2. run validator

What is the expected result?

The validator should run without throwing an exception and the validation results should be displayed.

What happens instead?

An Exception is thrown, no pt_assistant validation results are shown.

Please provide any additional information below. Attach a screenshot if possible.

By doing some basic testing I noticed that the error seems to only occur when a platform is mapped as a way, not on routes without those platform ways.

Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2020-06-02 08:27:29 +0200 (Tue, 02 Jun 2020)
Build-Date:2020-06-02 11:11:35
Relative:URL: ^/trunk

Identification: JOSM/1.5 (16538 en) Windows 10 64-Bit
OS Build number: Windows 10 Education 2004 (19041)
Memory Usage: 1476 MB / 3630 MB (470 MB allocated, but free)
Java version: 1.8.0_251-b08, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM
Look and Feel:
Screen: \Display0 1920x1080, \Display1 1280x1024
Maximum Screen Size: 1920x1080
Dataset consistency test: No problems found

+ CustomizePublicTransportStop (35248)
+ pt_assistant (2.1.10-80-g7d9bba3)

Validator rules:

Last errors/warnings:
- E: Handled by bug report queue: java.lang.NullPointerException
- E: Handled by bug report queue: java.lang.NullPointerException
- E: Handled by bug report queue: java.lang.NullPointerException
- E: Handled by bug report queue: java.lang.NullPointerException
- E: Handled by bug report queue: java.lang.NullPointerException

No data collected.

Warning issued by: BugReportExceptionHandler#handleException

Thread: AWT-EventQueue-0 (27) of main
	at org.openstreetmap.josm.plugins.pt_assistant.utils.StopToWayAssigner.get(
	at org.openstreetmap.josm.plugins.pt_assistant.validation.SegmentChecker.performStopNotServedTest(
	at org.openstreetmap.josm.plugins.pt_assistant.validation.PTAssistantValidatorTest.proceedWithSorting(
	at org.openstreetmap.josm.plugins.pt_assistant.validation.PTAssistantValidatorTest.visit(
	at org.openstreetmap.josm.actions.ValidateAction$ValidationTask.realRun(
	at org.openstreetmap.josm.gui.PleaseWaitRunnable.doRealRun(
	at java.util.concurrent.Executors$ Source)
	at Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$ Source)
	at Source)

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by simon04

Cc: michael2402 floscher Polyglot added

comment:2 Changed 7 months ago by taylor.smock

Owner: changed from Biswesh to max.walder@…
Status: newneedinfo

I haven't been able to reproduce.

Looking at the code, it is likely getBBox returned null (since stop.getPlatform() != null is checked previously). Which is interesting, since a Way has been unable to return a null bbox since at least 2009.

Last edited 7 months ago by taylor.smock (previous) (diff)

comment:3 Changed 7 months ago by taylor.smock

Resolution: fixed
Status: needinfoclosed

I've done a deeper dive into this problem, and I think the crash is "fixed" (see ecd4671f9beb24861808c776344ea4d71c0ec40d).

In context of comment:2, since I found it unlikely for a null bbox to be returned, it is likely that potentialStopPosition.getCoor() returned null, and then the method call to .distanceSq caused the NPE. Which is definitely possible (Node#getCoor will return null if Node#isLatLonKnown returns false).

In that case, Node#lon and/or Node#lat will return Double.NaN, which will could mess up the closestStopPosition, depending upon NaN semantics. On Mac OS X with Java 11, the min call should not be an issue with Comparator.comparingDouble. I tested with jshell DoubleStream.of(0, Double.NaN, -1, 1, Double.MAX_VALUE, Double.MIN_VALUE).boxed().min(Comparator.comparingDouble(b -> b.doubleValue())). Using max` did cause a problem.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain max.walder@….
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.