On Wed, 27 Jan 2021 20:22:00 GMT, Serguei Spitsyn <sspit...@openjdk.org> wrote:
>>> Do you think it is reasonable to treat "gz=[number]/[non-number]" >>> differently in this case? or should it just exit with error for all "gz=" >>> options that is not in the range of compression level? BTW, I think your >>> suggested code is better if we consider all illegal compression level as an >>> error. >> >> I think we should produce an error for something like `gz=abc` rather than >> use that as the filename, because I think it is likely user error. However, >> then you also need to figure out what to do with `gz=1 gz=abc`. Since the >> first argument is a proper `gz=` argument, you might miss the fact that the >> second also starts with `gz=` and accept it as a filename. Maybe in this >> example that is ok, but what if the user specifies `gz=1 gz=2`. Now it would >> seem they accidentally did two `gz=` arguments and an error should be >> produced, so I would suggest just always producing an error if the filename >> starts with `gz=`. > >> I think we should produce an error for something like gz=abc rather than use >> that as the filename, because I think it is likely user error. > Agreed. My suggestion was exactly this. We have to return an error in any > attempt to start filename with "gz=". It will also simplify the code and make > it more straightforward. @sspitsyn @plummercj, Thanks for your suggestion, I have made a fix of filename logic. ------------- PR: https://git.openjdk.java.net/jdk/pull/1712