Index: trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java
===================================================================
--- trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java	(revision 6372)
+++ trunk/src/org/openstreetmap/josm/data/validation/tests/OpeningHourTest.java	(revision 6373)
@@ -1,2 +1,3 @@
+// License: GPL. See LICENSE file for details.
 package org.openstreetmap.josm.data.validation.tests;
 
@@ -4,4 +5,6 @@
 
 import java.io.InputStreamReader;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -14,4 +17,5 @@
 import javax.script.ScriptException;
 
+import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.osm.Node;
 import org.openstreetmap.josm.data.osm.OsmPrimitive;
@@ -28,12 +32,12 @@
  * <a href="https://github.com/ypid/opening_hours.js">opening_hours.js</a>.
  *
- * @author frsantos
+ * @since 6370
  */
 public class OpeningHourTest extends Test {
 
     /**
-     * Javascript Rhino engine
+     * Javascript engine
      */
-    public static final ScriptEngine ENGINE = new ScriptEngineManager().getEngineByName("rhino");
+    public static final ScriptEngine ENGINE = new ScriptEngineManager().getEngineByName("JavaScript");
 
     /**
@@ -48,6 +52,10 @@
     public void initialize() throws Exception {
         super.initialize();
-        ENGINE.eval(new InputStreamReader(new MirroredInputStream("resource://data/opening_hours.js"), "UTF-8"));
-        ENGINE.eval("var oh = function (x, y) {return new opening_hours(x, y);};");
+        if (ENGINE != null) {
+            ENGINE.eval(new InputStreamReader(new MirroredInputStream("resource://data/opening_hours.js"), "UTF-8"));
+            ENGINE.eval("var oh = function (x, y) {return new opening_hours(x, y);};");
+        } else {
+            Main.warn("Unable to initialize OpeningHourTest because no JavaScript engine has been found");
+        }
     }
 
@@ -65,4 +73,23 @@
         } else if (obj instanceof List) {
             return (List<Object>) obj;
+        } else if ("sun.org.mozilla.javascript.internal.NativeArray".equals(obj.getClass().getName())) {
+            List<Object> list = new ArrayList<Object>();
+            try {
+                Method getIds = obj.getClass().getMethod("getIds");
+                Method get = obj.getClass().getMethod("get", long.class);
+                Object[] ids = (Object[]) getIds.invoke(obj);
+                for (Object id : ids) {
+                    list.add(get.invoke(obj, id));
+                }
+            } catch (NoSuchMethodException e) {
+                Main.error("Unable to run OpeningHourTest because of NoSuchMethodException by reflection: "+e.getMessage());
+            } catch (IllegalArgumentException e) {
+                Main.error("Unable to run OpeningHourTest because of IllegalArgumentException by reflection: "+e.getMessage());
+            } catch (IllegalAccessException e) {
+                Main.error("Unable to run OpeningHourTest because of IllegalAccessException by reflection: "+e.getMessage());
+            } catch (InvocationTargetException e) {
+                Main.error("Unable to run OpeningHourTest because of InvocationTargetException by reflection: "+e.getMessage());
+            }
+            return list;
         } else {
             throw new IllegalArgumentException("Not expecting class " + obj.getClass());
@@ -78,5 +105,5 @@
      */
     public List<TestError> checkOpeningHourSyntax(final String value) {
-        if (value == null || value.trim().isEmpty()) {
+        if (ENGINE == null || value == null || value.trim().isEmpty()) {
             return Collections.emptyList();
         }
@@ -90,5 +117,5 @@
         } catch (ScriptException ex) {
             final String message = ex.getMessage()
-                    .replace("sun.org.mozilla.javascript.JavaScriptException: ", "")
+                    .replace("sun.org.mozilla.javascript.internal.JavaScriptException: ", "opening_hours - ")
                     .replaceAll("\\(<Unknown source.*", "")
                     .trim();
