Modify

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#22156 closed defect (fixed)

ArithmeticException: / by zero in org.openstreetmap.josm.data.osm.search.SearchCompiler$Nth.match

Reported by: mikeho Owned by: taylor.smock
Priority: normal Milestone: 22.06
Component: Core Version:
Keywords: template_report Cc: mikeho

Description (last modified by taylor.smock)

What steps will reproduce the problem?

  1. filter: "nth%: 0" and the error occurred !

What is the expected result?

Background:

I am looking for railroad switches that are not tagged as. Therefore nodes are of interest, which are on 2, 3, 4 ways with the condition "railway=rail". Not of interest are nodes, which are only on one way.

Also not of interest are nodes which connect only two ways (end-nodes): e.g. track / track on bridge / track (railway = rail / railway = rail, bridge=yes / railway = rail).

I checked some options:

  • "nth: 1"
  • "nth: -1"
  • "nth: 1 | nth: -1"

with out success.

In the documentation I found nth and nth% (without explanation what the "%" stands for).
I checked some options:

  • "nth%: 2"
  • "nth%: 1"

- "nth%: 0" - and the error occurred


For your infomation:


josm download via overpass:

[bbox: 47.5, 7.6, 48, 9 ];
way[railway=rail]->.w1; 
node[w1]->.n1; 
(.w1; .n1;)->._; 
(._;>;); 
out meta; 

used filters:

filter #1: "ways: 1"

(with: E: on, H: on, I: off, M: "A")

filter #2: "child (type:way & railway:) & ways: 2- & -railway=switch"

(with: E: on, H: off, I: on, M: "A")

What happens instead?

The error dialog was shown.

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

Revision:18463
Build-Date:2022-05-30 10:23:53

Identification: JOSM/1.5 (18463 de) Windows 10 64-Bit
OS Build number: Windows 10 Home 2009 (19044)
Memory Usage: 616 MB / 8160 MB (398 MB allocated, but free)
Java version: 17.0.3+7-LTS, Azul Systems, Inc., OpenJDK 64-Bit Server VM
Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel
Screen: \Display0 1920×1200 (scaling 1.00×1.00) \Display1 3840×2160 (scaling 1.00×1.00) \Display2 1920×1200 (scaling 1.00×1.00)
Maximum Screen Size: 3840×2160
Best cursor sizes: 16×16→32×32, 32×32→32×32
System property file.encoding: Cp1252
System property sun.jnu.encoding: Cp1252
Locale info: de_DE
Numbers with default locale: 1234567890 -> 1234567890
VM arguments: [-Djpackage.app-version=1.5.18463, --add-modules=java.scripting,java.sql,javafx.controls,javafx.media,javafx.swing,javafx.web, --add-exports=java.base/sun.security.action=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.plugins.jpeg=ALL-UNNAMED, --add-exports=java.desktop/com.sun.imageio.spi=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED, --add-opens=java.base/jdk.internal.ref=ALL-UNNAMED, --add-opens=java.desktop/javax.imageio.spi=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED, -Djpackage.app-path=%UserProfile%\AppData\Local\JOSM\JOSM.exe]
Dataset consistency test: No problems found

Plugins:
+ changeset-viewer (v0.0.4)
+ measurement (35893)
+ tageditor (35893)
+ tagging-preset-tester (35893)
+ utilsplugin2 (35970)

Tagging presets:
+ https://www.openrailwaymap.org/josm-presets/de-signals-eso.zip
+ https://www.openrailwaymap.org/josm-presets/de.zip
+ https://www.openrailwaymap.org/josm-presets/de-signals-bostrab.zip
+ https://josm.openstreetmap.de/josmfile?page=Presets/OpenStationMap&zip=1
+ https://josm.openstreetmap.de/josmfile?page=Presets/OpenStationMap&zip=1

Map paint styles:
- https://josm.openstreetmap.de/josmfile?page=Styles/Maxspeed&zip=1
- https://www.openrailwaymap.org/styles/electrified.zip
- https://www.openrailwaymap.org/styles/standard.zip
- https://www.openrailwaymap.org/styles/maxspeed.zip
- https://www.openrailwaymap.org/styles/signals.zip
+ %UserProfile%\Desktop\J-OSM\railway.map.css

Last errors/warnings:
- 00011.625 E: Defekte Taggingvorlage "railway:signal:position-Signal position" - Anzahl der Elemente in 'display_values' muss gleich sein wie in 'values'.
- 00011.625 E: Detaillierte Information: [left in direction of OSM way, right in direction of OSM way] <> [left, right, overhead, in_track]
- 00011.625 E: Defekte Taggingvorlage "railway:signal:position-Signal position" - Anzahl der Elemente in 'locale_display_values' muss gleich sein wie in 'values'.
- 00011.625 E: Detaillierte Information: [Links von Wegrichtung, Rechts von Wegrichtung] <> [left, right, overhead, in_track]
- 00011.626 E: Defekte Taggingvorlage "public_transport-Public transport?" - Anzahl der Elemente in 'display_values' muss gleich sein wie in 'values'.
- 00011.626 E: Detaillierte Information: [yes, no] <> [station]
- 00011.626 E: Defekte Taggingvorlage "public_transport-Public transport?" - Anzahl der Elemente in 'locale_display_values' muss gleich sein wie in 'values'.
- 00011.626 E: Detaillierte Information: [ja, nein] <> [station]
- 01692.940 W: org.openstreetmap.josm.data.osm.search.SearchParseError: Fehler beim Einlesen des MapCSS-Selektors. Ursache: org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException: Encountered " <S> "  "" at line 1, column 1.
- 02266.856 E: Handled by bug report queue: java.lang.ArithmeticException: / by zero



=== REPORTED CRASH DATA ===
BugReportExceptionHandler#handleException:
No data collected.

Warning issued by: BugReportExceptionHandler#handleException

=== STACK TRACE ===
Thread: AWT-EventQueue-0 (24) of main
java.lang.ArithmeticException: / by zero
	at org.openstreetmap.josm.data.osm.search.SearchCompiler$Nth.match(SearchCompiler.java:1316)
	at org.openstreetmap.josm.data.osm.search.SearchCompiler$Match.match(SearchCompiler.java:287)
	at org.openstreetmap.josm.data.osm.search.SearchCompiler$Not.match(SearchCompiler.java:486)
	at org.openstreetmap.josm.data.osm.FilterMatcher.test(FilterMatcher.java:241)
	at org.openstreetmap.josm.data.osm.FilterMatcher.isHidden(FilterMatcher.java:309)
	at org.openstreetmap.josm.data.osm.FilterWorker.doExecuteFilters(FilterWorker.java:62)
	at org.openstreetmap.josm.data.osm.FilterWorker.executeFilters(FilterWorker.java:53)
	at org.openstreetmap.josm.data.osm.FilterModel.executeFilters(FilterModel.java:114)
	at org.openstreetmap.josm.gui.dialogs.FilterTableModel.executeFilters(FilterTableModel.java:100)
	at org.openstreetmap.josm.gui.dialogs.FilterTableModel.updateFilters(FilterTableModel.java:75)
	at org.openstreetmap.josm.gui.dialogs.FilterTableModel.setValue(FilterTableModel.java:181)
	at org.openstreetmap.josm.gui.dialogs.FilterDialog$EditAction.actionPerformed(FilterDialog.java:166)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
	at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
	at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
	at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.Component.processEvent(Unknown Source)
	at java.desktop/java.awt.Container.processEvent(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
	at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Attachments (0)

Change History (5)

comment:1 by taylor.smock, 2 years ago

Owner: changed from team to taylor.smock
Status: newassigned
Summary: Dailog Filter: "nth%: 0" - and the error occurredArithmeticException: / by zero in org.openstreetmap.josm.data.osm.search.SearchCompiler$Nth.match

comment:2 by taylor.smock, 2 years ago

Description: modified (diff)

comment:3 by taylor.smock, 2 years ago

The nth% is a modulo operation.
So, using the example from the tooltip, nth%:100 (child waterway) would select every 100th node of the waterways. Or (in your case), the filter would hide every 100th node in a waterway.

comment:4 by taylor.smock, 2 years ago

Resolution: fixed
Status: assignedclosed

In 18496/josm:

Fix #22156: ArithmeticException: / by zero in org.openstreetmap.josm.data.osm.search.SearchCompiler$Nth.match

This was caused by nth%: 0, as x % 0 will throw a divide by 0
exception.

comment:5 by taylor.smock, 2 years ago

Milestone: 22.06

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain taylor.smock.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.