Modify

Opened 12 years ago

Closed 12 years ago

#8593 closed defect (fixed)

MapCSS: PatternSyntaxException in case of an (possible) incorrect regular expression

Reported by: imagic Owned by: team
Priority: minor Milestone:
Component: Core mappaint Version: tested
Keywords: regexp regular expression PatternSyntaxException Cc:

Description (last modified by Don-vip)

I try to write a rule in a MapCSS style that does NOT match a regular expression. I tried the following rule:

node[traffic_sign~=maxspeed][maxspeed=implicit][overtaking=yes]["source:maxspeed"=~/?!.*zone.*/]

This resulted in a PatternSyntaxException (see below). The regular expression might be wrong (actually I don't know) but it should not crash JOSM.

Repository Root: http://josm.openstreetmap.de/svn
Build-Date: 2013-04-09 01:34:26
Last Changed Author: stoecker
Revision: 5836
Repository UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
URL: http://josm.openstreetmap.de/svn/trunk
Last Changed Date: 2013-04-07 23:18:22 +0200 (Sun, 07 Apr 2013)
Last Changed Rev: 5836

Identification: JOSM/1.5 (5836 en) Linux
Memory Usage: 306 MB / 853 MB (89 MB allocated, but free)
Java version: 1.6.0_20, Sun Microsystems Inc., Java HotSpot(TM) Server VM
Operating system: Linux
VM arguments: [-DproxySet=xxxx, -DproxyHost=xxxxx, -DproxyPort=xxxx]
Dataset consistency test: No problems found

Plugin: buildings_tools (29435)
Plugin: imagery_offset_db (29467)
Plugin: openstreetbugs (29435)
Plugin: openvisible (29435)
Plugin: reverter (29435)
Plugin: turnrestrictions (29435)
Plugin: utilsplugin2 (29435)

java.util.regex.PatternSyntaxException: Dangling meta character '?' near index 0
?!.*zone.*
^
	at java.util.regex.Pattern.error(Pattern.java:1713)
	at java.util.regex.Pattern.sequence(Pattern.java:1878)
	at java.util.regex.Pattern.expr(Pattern.java:1752)
	at java.util.regex.Pattern.compile(Pattern.java:1460)
	at java.util.regex.Pattern.<init>(Pattern.java:1133)
	at java.util.regex.Pattern.compile(Pattern.java:823)
	at org.openstreetmap.josm.gui.mappaint.mapcss.Condition$Op.eval(Condition.java:77)
	at org.openstreetmap.josm.gui.mappaint.mapcss.Condition$KeyValueCondition.applies(Condition.java:161)
	at org.openstreetmap.josm.gui.mappaint.mapcss.Selector$GeneralSelector.matchesConditions(Selector.java:286)
	at org.openstreetmap.josm.gui.mappaint.mapcss.Selector$GeneralSelector.matches(Selector.java:295)
	at org.openstreetmap.josm.gui.mappaint.mapcss.MapCSSStyleSource.apply(MapCSSStyleSource.java:157)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.generateStyles(ElemStyles.java:303)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.getImpl(ElemStyles.java:151)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.getStyleCacheWithRange(ElemStyles.java:71)
	at org.openstreetmap.josm.gui.mappaint.ElemStyles.get(ElemStyles.java:54)
	at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer$StyleCollector.add(StyledMapRenderer.java:182)
	at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.collectNodeStyles(StyledMapRenderer.java:360)
	at org.openstreetmap.josm.data.osm.visitor.paint.StyledMapRenderer.render(StyledMapRenderer.java:1390)
	at org.openstreetmap.josm.gui.layer.OsmDataLayer.paint(OsmDataLayer.java:317)
	at org.openstreetmap.josm.gui.MapView.paintLayer(MapView.java:503)
	at org.openstreetmap.josm.gui.MapView.paint(MapView.java:587)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JSplitPane.paintChildren(JSplitPane.java:1030)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JLayeredPane.paint(JLayeredPane.java:567)
	at javax.swing.JComponent.paintChildren(JComponent.java:862)
	at javax.swing.JComponent.paint(JComponent.java:1038)
	at javax.swing.JComponent.paintToOffscreen(JComponent.java:5124)
	at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:278)
	at javax.swing.RepaintManager.paint(RepaintManager.java:1224)
	at javax.swing.JComponent._paintImmediately(JComponent.java:5072)
	at javax.swing.JComponent.paintImmediately(JComponent.java:4882)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:785)
	at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:713)
	at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:693)
	at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:125)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

Attachments (0)

Change History (5)

comment:1 by Don-vip, 12 years ago

Description: modified (diff)

comment:2 by Don-vip, 12 years ago

Not directly related to your problem, but I see this:

-DproxySet=xxxx, -DproxyHost=xxxxx, -DproxyPort=xxxx

I assume you have hidden your proxy setup for privacy concerns ? If so I can do it automatically into JOSM (see #8571).

in reply to:  2 comment:3 by imagic, 12 years ago

Replying to Don-vip:

Not directly related to your problem, but I see this:

-DproxySet=xxxx, -DproxyHost=xxxxx, -DproxyPort=xxxx

I assume you have hidden your proxy setup for privacy concerns ? If so I can do it automatically into JOSM (see #8571).

Absolutely correct. Those settings should be hidden automatically.

comment:4 by Don-vip, 12 years ago

In 5840/josm:

see #8571, #8593 - Hide values of proxy VM arguments for privacy concerns

comment:5 by Don-vip, 12 years ago

Resolution: fixed
Status: newclosed

In 5841/josm:

fix #8593 - MapCSS: robustness to invalid regex patterns

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
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.