RFR: 8146632: Add descriptive error messages for removed non-product logging flags.

Dmitry Dmitriev dmitry.dmitriev at oracle.com
Wed Mar 16 08:47:52 UTC 2016


Hi Max,

If develop flag exist in removed_develop_logging_flags then flag search 
is performed second time. I think that is_removed_develop_logging_flag 
and removed_develop_logging_flag_name can be refactored. Actually, I 
think that we only need removed_develop_logging_flag_name function and 
is_removed_develop_logging_flag can be removed. E.g.:
   const char* Arguments::removed_develop_logging_flag_name(const char* 
name){
     for (size_t i = 0; removed_develop_logging_flags[i].alias_name != 
NULL; i++) {
       const AliasedFlag& flag = removed_develop_logging_flags[i];
       if (strcmp(flag.alias_name, name) == 0) {
         return flag.real_name;
       }
     }
     return NULL;
   }
...
    // Only make the obsolete check for valid arguments.
    if (arg_len <= BUFLEN) {
      // Construct a string which consists only of the argument name 
without '+', '-', or '='.
      char stripped_argname[BUFLEN+1];
      strncpy(stripped_argname, argname, arg_len);
      stripped_argname[arg_len] = '\0';  // strncpy may not null terminate.
      const char* replacement;

      if (is_obsolete_flag(stripped_argname, &since)) {
        char version[256];
        since.to_string(version, sizeof(version));
        warning("Ignoring option %s; support was removed in %s", 
stripped_argname, version);
        return true;
      }
  #ifndef PRODUCT
      else if ((replacement = 
removed_develop_logging_flag_name(stripped_argname)) != NULL){
        jio_fprintf(defaultStream::error_stream(),
                    "%s has been removed. Please use %s instead.\n", 
stripped_argname, replacement);
        return false;
  #endif
      }

What you think about that?

Thanks,
Dmitry

On 15.03.2016 20:45, Max Ockner wrote:
> Hello again everyone!
>
> Please review this change which adds better error messages for 
> non-product flags that are now converted to Unified Logging.
>
> bug: https://bugs.openjdk.java.net/browse/JDK-8146632
> webrev: http://cr.openjdk.java.net/~mockner/8146632/
>
> Since these options have been removed, we want still want the vm to 
> crash here, but now with an error message giving the correct command 
> line option. The new message looks like this:
>
> > TraceClassInitialization has been removed. Please use 
> -Xlog:classinit instead."
>
> The entire output looks like this:
>
> > TraceClassInitialization has been removed. Please use 
> -Xlog:classinit instead.
> > Error: Could not create the Java Virtual Machine.
> > Error: A fatal exception has occurred. Program will exit.
>
> Tested with jtreg runtime tests. A new test checks for an appropriate 
> error message for every develop flag that has so far been converted to 
> logging.
>
> Thanks,
> Max
>
>



More information about the hotspot-runtime-dev mailing list