Merge "Fix issue with RawMonitorWait."
diff --git a/openjdkjvmti/ti_monitor.cc b/openjdkjvmti/ti_monitor.cc
index 61bf533..1ec566b 100644
--- a/openjdkjvmti/ti_monitor.cc
+++ b/openjdkjvmti/ti_monitor.cc
@@ -247,12 +247,8 @@
   JvmtiMonitor* monitor = DecodeMonitor(id);
   art::Thread* self = art::Thread::Current();
 
-  // This is not in the spec, but it's the only thing that makes sense (and agrees with
-  // Object.wait).
-  if (millis < 0) {
-    return ERR(ILLEGAL_ARGUMENT);
-  }
-
+  // What millis < 0 means is not defined in the spec. Real world agents seem to assume that it is a
+  // valid call though. We treat it as though it was 0 and wait indefinitely.
   bool result = (millis > 0)
       ? monitor->Wait(self, static_cast<uint64_t>(millis))
       : monitor->Wait(self);
diff --git a/test/923-monitors/expected.txt b/test/923-monitors/expected.txt
index 5fbfb98..81a4fd0 100644
--- a/test/923-monitors/expected.txt
+++ b/test/923-monitors/expected.txt
@@ -13,7 +13,7 @@
 Wait
 JVMTI_ERROR_NOT_MONITOR_OWNER
 Wait
-JVMTI_ERROR_ILLEGAL_ARGUMENT
+JVMTI_ERROR_NOT_MONITOR_OWNER
 Wait
 JVMTI_ERROR_NOT_MONITOR_OWNER
 Lock