diff --git a/android/guava/src/com/google/common/io/Files.java b/android/guava/src/com/google/common/io/Files.java index a23cd96b3963..34de31eff5ba 100644 --- a/android/guava/src/com/google/common/io/Files.java +++ b/android/guava/src/com/google/common/io/Files.java @@ -398,6 +398,11 @@ public static boolean equal(File file1, File file2) throws IOException { * be exploited to create security vulnerabilities, especially when executable files are to be * written into the directory. * + *

Depending on the environmment that this code is run in, the system temporary directory (and + * thus the directory this method creates) may be more visible that a program would like - files + * written to this directory may be read or overwritten by hostile programs running on the same + * machine. + * *

This method assumes that the temporary volume is writable, has free inodes and free blocks, * and that it will not be called thousands of times per second. * @@ -406,8 +411,15 @@ public static boolean equal(File file1, File file2) throws IOException { * * @return the newly-created directory * @throws IllegalStateException if the directory could not be created + * @deprecated For Android users, see the Data and File + * Storage overview to select an appropriate temporary directory (perhaps {@code + * context.getCacheDir()}). For developers on Java 7 or later, use {@link + * java.nio.file.Files#createTempDirectory}, transforming it to a {@link File} using {@link + * java.nio.file.Path#toFile() toFile()} if needed. */ @Beta + @Deprecated public static File createTempDir() { File baseDir = new File(System.getProperty("java.io.tmpdir")); @SuppressWarnings("GoodTime") // reading system time without TimeSource diff --git a/guava/src/com/google/common/io/Files.java b/guava/src/com/google/common/io/Files.java index a23cd96b3963..34de31eff5ba 100644 --- a/guava/src/com/google/common/io/Files.java +++ b/guava/src/com/google/common/io/Files.java @@ -398,6 +398,11 @@ public static boolean equal(File file1, File file2) throws IOException { * be exploited to create security vulnerabilities, especially when executable files are to be * written into the directory. * + *

Depending on the environmment that this code is run in, the system temporary directory (and + * thus the directory this method creates) may be more visible that a program would like - files + * written to this directory may be read or overwritten by hostile programs running on the same + * machine. + * *

This method assumes that the temporary volume is writable, has free inodes and free blocks, * and that it will not be called thousands of times per second. * @@ -406,8 +411,15 @@ public static boolean equal(File file1, File file2) throws IOException { * * @return the newly-created directory * @throws IllegalStateException if the directory could not be created + * @deprecated For Android users, see the Data and File + * Storage overview to select an appropriate temporary directory (perhaps {@code + * context.getCacheDir()}). For developers on Java 7 or later, use {@link + * java.nio.file.Files#createTempDirectory}, transforming it to a {@link File} using {@link + * java.nio.file.Path#toFile() toFile()} if needed. */ @Beta + @Deprecated public static File createTempDir() { File baseDir = new File(System.getProperty("java.io.tmpdir")); @SuppressWarnings("GoodTime") // reading system time without TimeSource