RFR 8048840: File.createTempFile has uninformative failure message

Jeremy Manson jeremymanson at google.com
Tue Jul 1 01:05:30 UTC 2014


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