#19685 closed defect (fixed)
NullPointerException when editing mapcss validator rules with invalid pseudo class
Reported by: | Famlam | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | 20.08 |
Component: | Core | Version: | |
Keywords: | template_report mapcss validator rules regression | Cc: |
Description
What steps will reproduce the problem?
- Open JOSM on any area
- Add a custom validator mapcss file (prefs -> validator -> second tab -> add a local file ending on .validator.mapcss)
- Edit this *.validator.mapcss file (and save) to contain a rule, i.e. add:
node["traffic_signals:direction"]:connection { group: tr("eigen filters"); throwWarning: tr("Node met {0} op een kruising van meerdere wegen", "{0.key}"); }
- Then modify the file to something containing a non-existent pseudo class selector (for example due to a typo, or just being used to press ctrl-S often, or have some autosave on, or ...)
node["traffic_signals:direction"]:connection:downloaded { group: tr("eigen filters"); throwWarning: tr("Node met {0} op een kruising van meerdere wegen", "{0.key}"); }
- Save again. JOSM will crash.
(Note that it does show a warning when initializing JOSM; only when JOSM is already open it really crashes)
What is the expected result?
No crash (maybe a warning)
What happens instead?
Crash
Please provide any additional information below. Attach a screenshot if possible.
URL:https://josm.openstreetmap.de/svn/trunk Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b Last:Changed Date: 2020-07-30 12:44:04 +0200 (Thu, 30 Jul 2020) Build-Date:2020-07-31 01:30:49 Revision:16812 Relative:URL: ^/trunk Identification: JOSM/1.5 (16812 nl) Windows 10 64-Bit OS Build number: Windows 10 Home 2004 (19041) Memory Usage: 766 MB / 1820 MB (371 MB allocated, but free) Java version: 1.8.0_261-b12, Oracle Corporation, Java HotSpot(TM) 64-Bit Server VM Look and Feel: com.sun.java.swing.plaf.windows.WindowsLookAndFeel Screen: \Display0 1920x1080 (scaling 1.0x1.0) Maximum Screen Size: 1920x1080 Best cursor sizes: 16x16 -> 32x32, 32x32 -> 32x32 Dataset consistency test: No problems found Plugins: + OpeningHoursEditor (35414) + imagery_offset_db (35405) + pt_assistant (2.1.10-80-g7d9bba3) + tageditor (35258) + turnlanes-tagging (283) + undelete (35499) + utilsplugin2 (35487) Map paint styles: - https://josm.openstreetmap.de/josmfile?page=Styles/Lane_and_Road_Attributes&zip=1 - https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1 Validator rules: + %UserProfile%\Documents\tijdelijke bestanden\josm-eigen.validator.mapcss Last errors/warnings: - W: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out - W: java.net.SocketTimeoutException: Read timed out - E: Skipping to the next rule, because of an error: - E: org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException: Encountered " "<" "< "" at line 270, column 59. - E: org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSException: Invalid pseudo class specified: downloaded - E: Handled by bug report queue: java.lang.NullPointerException === REPORTED CRASH DATA === BugReportExceptionHandler#handleException: No data collected. Warning issued by: BugReportExceptionHandler#handleException === STACK TRACE === Thread: File Watcher (24) java.lang.NullPointerException at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException.initialise(ParseException.java:125) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException.<init>(ParseException.java:39) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.generateParseException(MapCSSParser.java:3725) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.error_skipto(MapCSSParser.java:2184) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.sheet(MapCSSParser.java:893) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker$TagCheck.readMapCSS(MapCSSTagChecker.java:359) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.addMapCSS(MapCSSTagChecker.java:790) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.addMapCSS(MapCSSTagChecker.java:778) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.reloadRule(MapCSSTagChecker.java:858) at org.openstreetmap.josm.io.FileWatcher.processEvents(FileWatcher.java:160) at java.lang.Thread.run(Unknown Source)
Attachments (0)
Change History (10)
comment:1 by , 4 years ago
Keywords: | external rule added; validator pseudo class selector NullPointerException removed |
---|---|
Summary: | Crash (NullPointerException) when editing mapcss validator rules with invalid pseudo class → NullPointerException when editing mapcss validator rules with invalid pseudo class |
comment:2 by , 4 years ago
Keywords: | validator rules added; external rule removed |
---|
Similar to #19503.
comment:3 by , 4 years ago
Perhaps it's advisable to run the auto-load functionality only when (the file has changed and) JOSM actually gets the focus (or better: is about to run the validator)
Warning or error: both are not that useful when you're in your text editor and JOSM is somewhere in the background. They only become useful when you actually want to use the file with rules.
(If so, I guess I should file this as a separate issue, or not?)
comment:4 by , 4 years ago
It simply should produce warnings like in other cases and not through exceptions. I like the autoload function and as long as you get the warnings only on the console there is no problem.
comment:5 by , 4 years ago
Full stack trace (in particular with JEP 358: Helpful NullPointerExceptions from Java 14)
2020-08-23 11:39:16.935 INFO: Source x.validator.mapcss has been modified. Reloading it... 2020-08-23 11:39:16.938 SEVERE: org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSException: Invalid pseudo class specified: xxx org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSException: Invalid pseudo class specified: xxx at org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory$PseudoClassCondition.createPseudoClassCondition(ConditionFactory.java:825) at org.openstreetmap.josm.gui.mappaint.mapcss.ConditionFactory.createPseudoClassCondition(ConditionFactory.java:128) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.class_or_pseudoclass(MapCSSParser.java:1545) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.selector(MapCSSParser.java:1129) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.child_selector(MapCSSParser.java:948) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.selectors(MapCSSParser.java:920) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.rule(MapCSSParser.java:905) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.sheet(MapCSSParser.java:889) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker$TagCheck.readMapCSS(MapCSSTagChecker.java:359) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.addMapCSS(MapCSSTagChecker.java:790) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.addMapCSS(MapCSSTagChecker.java:778) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.reloadRule(MapCSSTagChecker.java:858) at org.openstreetmap.josm.io.FileWatcher.processEvents(FileWatcher.java:160) at java.base/java.lang.Thread.run(Thread.java:834) 2020-08-23 11:39:16.947 SEVERE: Handled by bug report queue: java.lang.NullPointerException java.lang.NullPointerException: Cannot read field "beginLine" because "currentToken.next" is null at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException.initialise(ParseException.java:125) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.ParseException.<init>(ParseException.java:39) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.generateParseException(MapCSSParser.java:3725) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.error_skipto(MapCSSParser.java:2184) at org.openstreetmap.josm.gui.mappaint.mapcss.parsergen.MapCSSParser.sheet(MapCSSParser.java:893) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker$TagCheck.readMapCSS(MapCSSTagChecker.java:359) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.addMapCSS(MapCSSTagChecker.java:790) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.addMapCSS(MapCSSTagChecker.java:778) at org.openstreetmap.josm.data.validation.tests.MapCSSTagChecker.reloadRule(MapCSSTagChecker.java:858) at org.openstreetmap.josm.io.FileWatcher.processEvents(FileWatcher.java:160) at java.base/java.lang.Thread.run(Thread.java:834)
In fact, #11593 occurring again…
comment:9 by , 4 years ago
Keywords: | regression added |
---|---|
Milestone: | → 20.08 |
This exception does not harm a lot but can get annoying . Only auto load function does not work after it. So you need either to manually load changed rules or restart JOSM.