RFR 8048840: File.createTempFile has uninformative failure message

Bernd ecki at zusammenkunft.net
Tue Jul 1 02:44:36 UTC 2014


Hello,

Do you think this fixes the complaints? I can imagine that "" or "~" is
used, and including this in the exception does not really help. "Prefix
string too short, must be 3 characters" would be my choice, but I wonder if
the restriction is very usefull anyway?

Bernd
 Am 01.07.2014 03:17 schrieb "Jeremy Manson" <jeremymanson at google.com>:

> Hi folks,
>
> We had a couple of complaints about this from our users, and it is a pretty
> trivial fix, so I'm throwing this out as a potential patch.  I
> filed JDK-8048840:
>
> 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);
>          if (suffix == null)
>              suffix = ".tmp";
>
> Jeremy
>



More information about the core-libs-dev mailing list