Opened 6 years ago

Last modified 6 years ago

#17932 closed defect

Update OpeningHourTest.java to enable propper logging — at Version 4

Reported by: SlowMo24 Owned by: Don-vip
Priority: normal Milestone: 19.08
Component: Core validator Version:
Keywords: opening_hours nashorn javascript Cc: ypid

Description (last modified by Don-vip)

What steps will reproduce the problem?

  1. set tag of an entity to 'opening_hours=SH off'
  2. click validate

What is the expected result?

Throw a proper error message to track down the problem like

2019-07-16 12:55:16.341 WARNUNG: javax.script.ScriptException: An error occurred during evaluation of the value "SH off". Please submit a pull request: https://github.com/ypid/opening_hours.js. no SH definition in <eval> at line number 46 at column number 4733. Cause: [...]

What happens instead?

the following error-message is shown:

2019-07-16 13:10:52.323 WARNUNG: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: [...]

Solution

Add

                ENGINE.eval(
                    "var global=this;var window=this;var process={env:{}};" +
                    "var console={};console.debug=print;console.log=print;console.warn=print;console.error=print;");

to the initialize() method of OpeningHourTestPatch.java as done in https://github.com/opening-hours/opening_hours.java/issues/1

Please provide any additional information below. Attach a screenshot if possible.

Relative:URL: ^/trunk
Repository:UUID: 0c6e7542-c601-0410-84e7-c038aed88b3b
Last:Changed Date: 2019-07-10 00:52:47 +0200 (Wed, 10 Jul 2019)
Revision:15238
Build-Date:2019-07-10 01:30:51
URL:https://josm.openstreetmap.de/svn/trunk

Identification: JOSM/1.5 (15238 de) Linux Ubuntu 18.04.2 LTS
Memory Usage: 449 MB / 4006 MB (329 MB allocated, but free)
Java version: 11.0.3+7-Ubuntu-1ubuntu218.04.1, Oracle Corporation, OpenJDK 64-Bit Server VM
Screen: :0.0 1920x1080, :0.1 1280x1024
Maximum Screen Size: 1920x1080
Java package: openjdk-11-jre:amd64-11.0.3+7-1ubuntu2~18.04.1
Java ATK Wrapper package: libatk-wrapper-java:all-0.33.3-20ubuntu0.1
libcommons-logging-java: libcommons-logging-java:all-1.2-2
fonts-noto: fonts-noto:-
Dataset consistency test: No problems found

Plugins:
+ FastDraw (34977)
+ OpeningHoursEditor (34977)
+ buildings_tools (34982)
+ pt_assistant (705)
+ wikipedia (v1.1.1)

Map paint styles:
+ https://josm.openstreetmap.de/josmfile?page=Styles/PublicTransport&zip=1

Last errors/warnings:
- W: No configuration settings found.  Using hardcoded default values for all pools.
- W: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined
- E: javax.script.ScriptException: ReferenceError: "console" is not defined in <eval> at line number 44. Ursache: jdk.nashorn.internal.runtime.ECMAException: ReferenceError: "console" is not defined

Change History (4)

comment:1 by Don-vip, 6 years ago

Keywords: opening_hours javascript added; openinghour removed
Milestone: 19.08
Version: tested

comment:2 by Don-vip, 6 years ago

Type: enhancementdefect

comment:3 by Don-vip, 6 years ago

Description: modified (diff)

comment:4 by Don-vip, 6 years ago

Description: modified (diff)
Owner: changed from team to Don-vip
Status: newassigned
Note: See TracTickets for help on using tickets.