﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
19685	NullPointerException when editing mapcss validator rules with invalid pseudo class	Famlam	team	"==== What steps will reproduce the problem?
1. Open JOSM on any area
2. Add a custom validator mapcss file (prefs -> validator -> second tab -> add a local file ending on .validator.mapcss)
3. 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}"");
}
}}}
4. 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}"");
}
}}}
5. 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)
}}}"	defect	closed	normal	20.08	Core		fixed	template_report mapcss validator rules regression	
