RFR 8048840: File.createTempFile has uninformative failure message (original) (raw)

Martin Buchholz martinrb at google.com
Tue Jul 1 23:33:15 UTC 2014


I agree that we should try for a better error message (for our users' debugging happiness, just including the prefix was enough). My suggestion:

"Prefix string "" + prefix + "" too short: length must be at least 3"

On Tue, Jul 1, 2014 at 4:16 PM, Jeremy Manson <jeremymanson at google.com> wrote:

Should I add a message about a three character minimum?

Jeremy

On Tue, Jul 1, 2014 at 1:34 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote: > On 01/07/2014 02:21, Jeremy Manson wrote: > >> Oops - forgot to run jtreg. Make that: >> >> diff --git a/src/share/classes/java/io/File.java >> b/src/share/classes/java/io/File.java >> --- a/src/share/classes/java/io/File.java >> +++ b/src/share/classes/java/io/File.java >> @@ -1998,7 +1998,8 @@ >> throws IOException >> { >> if (prefix.length() < 3)_ _>> - throw new IllegalArgumentException("Prefix string too >> short"); >> + throw new IllegalArgumentException("Prefix string too >> short: " >> + >> + prefix); >> > I assume you meant to "+ prefix" here, in which case the change seems okay > to me. The update to the NulFile test seems okay too. > > As a side point then I think the need for a prefix is somewhat legacy now > and this API could be re-visited some day. > > -Alan. >



More information about the core-libs-dev mailing list