code review request: 7051946: Runtime.exec(String command) / ProcessBuilder command parsing issues
Alan Bateman
Alan.Bateman at oracle.com
Wed Sep 14 10:14:44 UTC 2011
Michael McMahon wrote:
> We could add a sentence to the existing @throws clause for IAE.
>
> So it would say "If |command| is empty, or on some platforms, may be
> thrown if command contains illegal characters".
>
> I'm reluctant to be more precise than that, since as far as I know,
> there doesn't appear to be
> any illegal characters for filenames in Unix.
I agree that you can't be too specific. I'm not sure if "illegal
characters" should be in the wording as it begs the question as to which
characters are legal. An alternative to trying to come up with some
wording is to just specify the long standing behavior which seems to be
that IOException is thrown if an I/O errors or the command line is
malformed. I see David's reply pointing out that there are similar
issues with ProcessBuilder. That is only specified to throw
IndexOutOfBoundException if the command line is empty so it would be
good to check those cases too.
-Alan.
More information about the core-libs-dev
mailing list