Modify

Opened 7 years ago

Last modified 7 years ago

#15582 new defect

SyntaxException with a possibly valid opening_hours

Reported by: naoliv Owned by: boman
Priority: normal Milestone:
Component: Plugin openinghourseditor Version:
Keywords: Cc:

Description

Have an object with opening_hours=Th 00:00-02:30,18:15-02:30, go to DataEdit opening hours and edit the existing tag:

https://i.imgur.com/eYcLyBk.png

2017-11-22 10:46:27.592 WARNING: org.openstreetmap.josm.plugins.ohe.parser.SyntaxException
org.openstreetmap.josm.plugins.ohe.parser.SyntaxException
	at org.openstreetmap.josm.plugins.ohe.parser.OpeningTimeCompiler.daytimespan(OpeningTimeCompiler.java:160)
	at org.openstreetmap.josm.plugins.ohe.parser.OpeningTimeCompiler.daytimespanlist(OpeningTimeCompiler.java:102)
	at org.openstreetmap.josm.plugins.ohe.parser.OpeningTimeCompiler.daytimespanlist(OpeningTimeCompiler.java:106)
	at org.openstreetmap.josm.plugins.ohe.parser.OpeningTimeCompiler.timespan(OpeningTimeCompiler.java:93)
	at org.openstreetmap.josm.plugins.ohe.parser.OpeningTimeCompiler.timespanlist(OpeningTimeCompiler.java:61)
	at org.openstreetmap.josm.plugins.ohe.parser.OpeningTimeCompiler.startCompile(OpeningTimeCompiler.java:32)
	at org.openstreetmap.josm.plugins.ohe.gui.OheDialogPanel.getTime(OheDialogPanel.java:133)
	at org.openstreetmap.josm.plugins.ohe.gui.OheEditor.initTimeRects(OheEditor.java:187)
	at org.openstreetmap.josm.plugins.ohe.gui.OheEditor.<init>(OheEditor.java:96)
	at org.openstreetmap.josm.plugins.ohe.gui.OheDialogPanel.<init>(OheDialogPanel.java:103)
	at org.openstreetmap.josm.plugins.ohe.OhePlugin$OheMenuAction.actionPerformed(OhePlugin.java:300)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1967)
	at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2308)
	at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:405)
	at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262)
	at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:369)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:980)
	at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1024)
	at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:297)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6578)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3343)
	at java.desktop/java.awt.Component.processEvent(Component.java:6343)
	at java.desktop/java.awt.Container.processEvent(Container.java:2259)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:4961)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2317)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4904)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4539)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4480)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2303)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2758)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4793)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:766)
	at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
	at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:99)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:739)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:737)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:736)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

2017-11-22 10:46:36.060 WARNING: Disable opening hours editor:: java.lang.Exception: Error in the TimeValue. Cause: org.openstreetmap.josm.plugins.ohe.parser.SyntaxException

The validator doesn't warn about anything.
For YoHours and the opening_hours evaluation tool it seems to be valid too.

JOSM:

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2017-11-20 01:25:31 +0100 (Mon, 20 Nov 2017)
Revision:13136
Build-Date:2017-11-20 02:32:02
URL:http://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (13136 en) Linux Debian GNU/Linux testing (buster)
Memory Usage: 999 MB / 7168 MB (382 MB allocated, but free)
Java version: 9.0.1+11-Debian-1, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1600x900, :0.1 1280x1024
Maximum Screen Size: 1600x1024
Java package: openjdk-9-jre:amd64-9.0.1+11-1
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-13
VM arguments: [--add-modules=java.activation,java.se.ee, -Dawt.useSystemAAFontSettings=on]
Program arguments: [--language=en]
Dataset consistency test: No problems found

Plugins:
+ CADTools (1007)
+ Create_grid_of_ways (32699)
+ DxfImport (1012)
+ FastDraw (33731)
+ ImportImagePlugin (33563)
+ OpeningHoursEditor (33185)
+ PicLayer (33822)
+ RoadSigns (33798)
+ SimplifyArea (33004)
+ apache-commons (33668)
+ buildings_tools (33735)
+ conflation (0.5.5)
+ contourmerge (1032)
+ download_along (33710)
+ editgpx (33782)
+ ejml (32680)
+ geojson (73)
+ geotools (33380)
+ importvec (33564)
+ indoorhelper (33632)
+ jts (32699)
+ log4j (32699)
+ measurement (33760)
+ merge-overlap (33848)
+ opendata (33791)
+ pbf (33568)
+ pdfimport (33579)
+ poly (33570)
+ reverter (33572)
+ scripting (30775)
+ tageditor (33806)
+ todo (30303)
+ turnlanes (33294)
+ turnlanes-tagging (254)
+ turnrestrictions (33780)
+ undelete (33835)
+ utilsplugin2 (33742)

Attachments (0)

Change History (12)

comment:1 by stoecker, 7 years ago

opening_hours=Th 00:00-02:30,18:15-02:30

I'd say the error is correct and it is wrong:

Either it is Th 00:00-02:30,18:15-24:00 or Th 00:00-02:30,18:15-24:00;Fr 00:00-02:30

comment:2 by Don-vip, 7 years ago

We should simply drop the plugin parser and rely on our embedded opening_hours.js library.

in reply to:  2 ; comment:3 by anonymous, 7 years ago

Replying to Don-vip:

We should simply drop the plugin parser and rely on our embedded opening_hours.js library.

Which in this case would mean to hide an error. Seems the JavaScript needs to be fixed.

in reply to:  1 comment:4 by naoliv, 7 years ago

Replying to stoecker:

opening_hours=Th 00:00-02:30,18:15-02:30

I'd say the error is correct and it is wrong:

Somehow my answer didn't appear here:
I also thought that opening_hours=Th 00:00-02:30,18:15-02:30 seems strange, but since other validators said that it's valid, I believed.

in reply to:  3 comment:5 by Don-vip, 7 years ago

Replying to anonyme:

Replying to Don-vip:

We should simply drop the plugin parser and rely on our embedded opening_hours.js library.

Which in this case would mean to hide an error. Seems the JavaScript needs to be fixed.

Go ahead :) https://github.com/opening-hours/opening_hours.js/issues/new

The library is much more advanced (used a lot and well tested). We currently have 0 unit test for the plugin parser and it has not been updated since 2010. No need to keep this implementation, it's better to contribute to the other one.

comment:6 by Don-vip, 7 years ago

In 13145/josm:

see #15582 - simplify our usage of opening_hours.js library (drop mode: it is deduced from tag key) + make the parse method public so it can be called from opening_hours plugin

comment:7 by Don-vip, 7 years ago

In 13147/josm:

see #15582 - mode is needed for conditional keys

comment:9 by stoecker, 7 years ago

They closed the ticket and say that's valid. Someone actually specified that values greater 24 are valid and 02:30 is a shortcut for 26:30. I think this is bullshit but it seems it is valid bullshit.

comment:10 by Don-vip, 7 years ago

In 13296/josm:

see #15582 - more public APIs for opening_hours parsing

comment:11 by Don-vip, 7 years ago

In 13297/josm:

see #15582 - one more public API for opening_hours parsing

comment:12 by Don-vip, 7 years ago

In 13298/josm:

see #15582 - simplify public API for opening_hours parsing

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain boman.
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from boman to the specified user.
Next status will be 'needinfo'. The owner will be changed from boman to naoliv.
as duplicate The resolution will be set to duplicate. Next status will be 'closed'. The specified ticket will be cross-referenced with this ticket.
The owner will be changed from boman to anonymous. Next status will be 'assigned'.

Add Comment


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