#20182 closed defect (fixed)
NumberFormatException in ConnectivityRelations.parseConnectivityTag
Reported by: | HarryPlotter | Owned by: | GerdP |
---|---|---|---|
Priority: | normal | Milestone: | 20.12 |
Component: | Core validator | Version: | |
Keywords: | Cc: | taylor.smock |
Description
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2020-11-21 14:56:29 +0100 (Sat, 21 Nov 2020) Build-Date:2020-11-22 02:30:52 Revision:17329 Relative:URL: ^/trunk Identification: JOSM/1.5 (17329 en) Windows 10 64-Bit OS Build number: Windows 10 Home 1909 (18363) Memory Usage: 165 MB / 247 MB (19 MB allocated, but free) Java version: 1.8.0_271-b09, Oracle Corporation, Java HotSpot(TM) Client VM Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel Screen: \Display0 1920x1080 (scaling 1.0x1.0), \Display1 1920x1080 (scaling 1.0x1.0) Maximum Screen Size: 1920x1080 Best cursor sizes: 16x16 -> 32x32, 32x32 -> 32x32 Dataset consistency test: No problems found Plugins: + EasyPresets (1595741614) + Mapillary (1.5.27) + apache-commons (35524) + apache-http (35589) + auto_tools (73) + buildings_tools (35640) + continuosDownload (91) + ejml (35458) + imagery_offset_db (35640) + javafx-windows (35458) + jaxb (35543) + jna (35458) + log4j (35458) + mapwithai (1.7.1.1) + mapwithai-dev (1.7.1.1-5-g793af99) + routing (35640) + turnrestrictions (35640) + utilsplugin2 (35640) Tagging presets: + https://josm.openstreetmap.de/josmfile?page=Presets/BuildingPreset&zip=1 Map paint styles: + https://raw.githubusercontent.com/KaartGroup/Kaart-Styles/master/Kaart-Styles.mapcss - https://josm.openstreetmap.de/josmfile?page=Styles/MapWithAI&zip=1 + https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 Validator rules: + https://raw.githubusercontent.com/KaartGroup/KaartValidator/master/kaart.clingstone.validator.mapcss Last errors/warnings: - 00037.370 E: Handled by bug report queue: java.lang.NumberFormatException: For input string: "right_turn" === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: AWT-EventQueue-0 (15) of main java.lang.NumberFormatException: For input string: "right_turn" at java.lang.NumberFormatException.forInputString(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at java.lang.Integer.parseInt(Unknown Source) at org.openstreetmap.josm.data.validation.tests.ConnectivityRelations.parseConnectivityTag(ConnectivityRelations.java:90) at org.openstreetmap.josm.data.validation.tests.ConnectivityRelations.checkForInconsistentLanes(ConnectivityRelations.java:152) at org.openstreetmap.josm.data.validation.tests.ConnectivityRelations.visit(ConnectivityRelations.java:135) at org.openstreetmap.josm.data.osm.Relation.accept(Relation.java:176) at org.openstreetmap.josm.data.validation.Test.visit(Test.java:216) at org.openstreetmap.josm.actions.upload.ValidateUploadHook.checkUpload(ValidateUploadHook.java:66) at org.openstreetmap.josm.actions.UploadAction.lambda$checkPreUploadConditions$0(UploadAction.java:219) at java.util.stream.MatchOps$1MatchSink.accept(Unknown Source) at java.util.LinkedList$LLSpliterator.tryAdvance(Unknown Source) at java.util.stream.ReferencePipeline.forEachWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyIntoWithCancel(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.util.stream.MatchOps$MatchOp.evaluateSequential(Unknown Source) at java.util.stream.MatchOps$MatchOp.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.allMatch(Unknown Source) at org.openstreetmap.josm.actions.UploadAction.checkPreUploadConditions(UploadAction.java:219) at org.openstreetmap.josm.actions.UploadAction.uploadData(UploadAction.java:236) at org.openstreetmap.josm.actions.UploadAction.actionPerformed(UploadAction.java:292) at javax.swing.SwingUtilities.notifyAction(Unknown Source) at javax.swing.JComponent.processKeyBinding(Unknown Source) at javax.swing.KeyboardManager.fireBinding(Unknown Source) at javax.swing.KeyboardManager.fireKeyboardAction(Unknown Source) at javax.swing.JComponent.processKeyBindingsForAllComponents(Unknown Source) at javax.swing.JComponent.processKeyBindings(Unknown Source) at javax.swing.JComponent.processKeyEvent(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.KeyboardFocusManager.redispatchEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(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.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(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)
Attachments (1)
Change History (8)
comment:1 by , 4 years ago
Component: | Core → Core validator |
---|---|
Owner: | changed from | to
Status: | new → assigned |
comment:2 by , 4 years ago
comment:3 by , 4 years ago
Milestone: | → 20.12 |
---|---|
Summary: | Unexpected Exception → NumberFormatException in ConnectivityRelations.parseConnectivityTag |
by , 4 years ago
Attachment: | 20182.patch added |
---|
follow-up: 5 comment:4 by , 4 years ago
Cc: | added |
---|
patch adds robustness for complete nonsense in tag connectivity and simplifies code
- fix crash with
connectivity=right_turn
or a single number likeconnectivity=1
- remove code which looks for "bw" after "bw" was replaced by -1000.
@tailor.smock
- The wiki shows no blanks in the values like
1:(1),2|2:3|3:4|4:5|5:6
and current OSM data contains none. Not sure if this should be checked, current code silently ignores several whitespace characters usingtrim()
. - There is no warning yet for nonsense like
connectivity=bw:(dunno)
Not sure what to do with that.
comment:5 by , 4 years ago
Replying to GerdP:
@taylor.smock
- The wiki shows no blanks in the values like
1:(1),2|2:3|3:4|4:5|5:6
and current OSM data contains none. Not sure if this should be checked, current code silently ignores several whitespace characters usingtrim()
.- There is no warning yet for nonsense like
connectivity=bw:(dunno)
Not sure what to do with that.
The bw:(dunno)
should probably be caught by a regex. Probably something like (bw|[0-9(),|:])+
would work. As far as extraneous whitespace goes, that wasn't explicit in the spec, IIRC. So we may want to discourage it. I'd probably use mapcss for both of the above issues.
// Ignore whitespace for regex, due to specific check w/ fix relation[connectivity!~/(bw|[0-9(),|: ])+/] { throwWarning: tr("connectivity does not match regex"); assertMatch: "relation connectivity=\"right_left:2\""; assertMatch: "relation connectivity=\"1:wb\""; assertMatch: "relation connectivity=\"1:w\""; assertMatch: "relation connectivity=\"1:b\""; assertNoMatch: "relation connectivity=\"1: 2\""; } // Replace whitespace in connectivity relations relation[connectivity=~/ +/] { throwWarning: tr("connectivity has extra spaces"); fixAdd: tr("connectivity={0}", replace(tag("connectivity"), " ", "")); assertMatch: "relation connectivity=\"1 : 2\""; assertMatch: "relation connectivity=\"1: 2\""; assertNoMatch: "relation connectivity=\"1:2\""; }
I should probably look into adding asserts for fixAdd
sometime. So assertFix: "relation connectivity=\"1 : 2\" => relation connectivity=\"1:2\"";
. But priorities and time.
comment:7 by , 4 years ago
I think it was left public so that the parsing code could be reused in plugins that deal with lane connectivity.
EDIT: And the empty map was to avoid returning null
so that users didn't have to check the map as null before iterating through the map. I think. If I remember correctly.
Seems you have a type=connectivity relation with an invalid tag
connectivity=right_turn
and the validator fails to produce a proper warning.