On Wed, 11 Sep 2024 14:13:37 GMT, Sonia Zaldana Calles <szald...@openjdk.org> wrote:
> Hi Simon, > > Thanks! Looks good. > > Just had a question about the empty filename issue. I don’t think there is a > case where a filename parameter should accept an empty string (but I might be > wrong). > > If that’s the case, I wonder if it would be better to just deal with all > empty filename parameter errors in the dcmd argument parser. > > For example, in > [diagnosticArgument.cpp](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/services/diagnosticArgument.cpp#L186). > Perhaps, we could have a check like this: > > ``` > if (strcmp(type(), "FILE") == 0) { > if (str == NULL || *str == 0) { > stringStream error_msg; > error_msg.print("Filename is empty or not specified. %s", str); > THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), > error_msg.base()); > } > _value = REALLOC_C_HEAP_ARRAY(char, _value, JVM_MAXPATHLEN, mtInternal); > ... > } > ``` > > I haven't tested this but this would probably be better handled in a separate > RFE though. Good idea. Separate RFE makes sense. ------------- PR Comment: https://git.openjdk.org/jdk/pull/20597#issuecomment-2343808208