Changeset 15277 in josm


Ignore:
Timestamp:
2019-08-04T21:29:37+02:00 (3 weeks ago)
Author:
Don-vip
Message:

fix #17932 - Update OpeningHourTest to enable propper logging

See https://github.com/opening-hours/opening_hours.java/issues/1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java

    r14455 r15277  
    1313import javax.script.ScriptEngine;
    1414import javax.script.ScriptException;
     15import javax.swing.JOptionPane;
    1516
    1617import org.openstreetmap.josm.command.ChangePropertyCommand;
     
    1920import org.openstreetmap.josm.data.validation.Test;
    2021import org.openstreetmap.josm.data.validation.TestError;
     22import org.openstreetmap.josm.gui.Notification;
    2123import org.openstreetmap.josm.io.CachedFile;
    2224import org.openstreetmap.josm.tools.LanguageInfo;
     
    5254            try (CachedFile cf = new CachedFile("resource://data/validator/opening_hours.js");
    5355                 Reader reader = cf.getContentReader()) {
     56                ENGINE.eval(
     57                        "var global=this;var window=this;var process={env:{}};" +
     58                        "var console={};console.debug=print;console.log=print;console.warn=print;console.error=print;");
    5459                ENGINE.eval(reader);
    5560                ENGINE.eval("var opening_hours = require('opening_hours');");
     
    247252        } catch (ScriptException | NoSuchMethodException ex) {
    248253            Logging.error(ex);
     254            new Notification(Utils.getRootCause(ex).getMessage()).setIcon(JOptionPane.ERROR_MESSAGE).show();
    249255        }
    250256        return errors;
Note: See TracChangeset for help on using the changeset viewer.