hotspot/src/share/vm/runtime/arguments.cpp
changeset 12165 22a13b8c1d4c
parent 12162 c802a72c356b
parent 12157 439a7166bf0f
child 12498 961dc4bd60d6
child 12983 c314338bc3da
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Tue Mar 20 13:10:13 2012 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 22 13:54:26 2012 -0700
@@ -816,8 +816,21 @@
     return true;
   }
 
-  jio_fprintf(defaultStream::error_stream(),
-              "Unrecognized VM option '%s'\n", argname);
+  // For locked flags, report a custom error message if available.
+  // Otherwise, report the standard unrecognized VM option.
+
+  Flag* locked_flag = Flag::find_flag((char*)argname, strlen(argname), true);
+  if (locked_flag != NULL) {
+    char locked_message_buf[BUFLEN];
+    locked_flag->get_locked_message(locked_message_buf, BUFLEN);
+    if (strlen(locked_message_buf) == 0) {
+      jio_fprintf(defaultStream::error_stream(),
+        "Unrecognized VM option '%s'\n", argname);
+    } else {
+      jio_fprintf(defaultStream::error_stream(), "%s", locked_message_buf);
+    }
+  }
+
   // allow for commandline "commenting out" options like -XX:#+Verbose
   return arg[0] == '#';
 }