6092N/A/*
6092N/A * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
6092N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6092N/A *
6092N/A * This code is free software; you can redistribute it and/or modify it
6092N/A * under the terms of the GNU General Public License version 2 only, as
6092N/A * published by the Free Software Foundation.
6092N/A *
6092N/A * This code is distributed in the hope that it will be useful, but WITHOUT
6092N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6092N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6092N/A * version 2 for more details (a copy is included in the LICENSE file that
6092N/A * accompanied this code).
6092N/A *
6092N/A * You should have received a copy of the GNU General Public License version
6092N/A * 2 along with this work; if not, write to the Free Software Foundation,
6092N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6092N/A *
6092N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6092N/A * or visit www.oracle.com if you need additional information or have any
6092N/A * questions.
6092N/A */
6092N/A
6092N/A/* @test
6092N/A * @bug 8003992
6092N/A * @summary Test a file whose path name is embedded with NUL character, and
6092N/A * ensure it is handled correctly.
6092N/A * @author Dan Xu
6092N/A */
6092N/A
6092N/Aimport java.io.File;
6092N/Aimport java.io.FileFilter;
6092N/Aimport java.io.FileInputStream;
6092N/Aimport java.io.FileOutputStream;
6092N/Aimport java.io.RandomAccessFile;
6092N/Aimport java.io.FileNotFoundException;
6092N/Aimport java.io.FilenameFilter;
6092N/Aimport java.io.IOException;
6092N/Aimport java.net.MalformedURLException;
6092N/Aimport java.nio.file.InvalidPathException;
6092N/Aimport java.io.ByteArrayInputStream;
6092N/Aimport java.io.ByteArrayOutputStream;
6092N/Aimport java.io.ObjectOutputStream;
6092N/Aimport java.io.ObjectInputStream;
6092N/A
6092N/Apublic class NulFile {
6092N/A
6092N/A private static final char CHAR_NUL = '\u0000';
6092N/A
6092N/A private static final String ExceptionMsg = "Invalid file path";
6092N/A
6092N/A public static void main(String[] args) {
6092N/A testFile();
6092N/A testFileInUnix();
6092N/A testFileInWindows();
6092N/A testTempFile();
6092N/A }
6092N/A
6092N/A private static void testFile() {
6092N/A test(new File(new StringBuilder().append(CHAR_NUL).toString()));
6092N/A test(new File(
6092N/A new StringBuilder().append("").append(CHAR_NUL).toString()));
6092N/A test(new File(
6092N/A new StringBuilder().append(CHAR_NUL).append("").toString()));
6092N/A }
6092N/A
6092N/A private static void testFileInUnix() {
6092N/A String osName = System.getProperty("os.name");
6092N/A if (osName.startsWith("Windows"))
6092N/A return;
6092N/A
6092N/A String unixFile = "/";
6092N/A test(unixFile);
6092N/A
6092N/A unixFile = "//";
6092N/A test(unixFile);
6092N/A
6092N/A unixFile = "data/info";
6092N/A test(unixFile);
6092N/A
6092N/A unixFile = "/data/info";
6092N/A test(unixFile);
6092N/A
6092N/A unixFile = "//data//info";
6092N/A test(unixFile);
6092N/A }
6092N/A
6092N/A private static void testFileInWindows() {
6092N/A String osName = System.getProperty("os.name");
6092N/A if (!osName.startsWith("Windows"))
6092N/A return;
6092N/A
6092N/A String windowsFile = "\\";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "\\\\";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "/";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "//";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "/\\";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "\\/";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "data\\info";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "\\data\\info";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "\\\\server\\data\\info";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "z:data\\info";
6092N/A test(windowsFile);
6092N/A
6092N/A windowsFile = "z:\\data\\info";
6092N/A test(windowsFile);
6092N/A }
6092N/A
6092N/A private static void test(final String name) {
6092N/A int length = name.length();
6092N/A
6092N/A for (int i = 0; i <= length; i++) {
6092N/A StringBuilder sbName = new StringBuilder(name);
6092N/A sbName.insert(i, CHAR_NUL);
6092N/A String curName = sbName.toString();
6092N/A
6092N/A // test File(String parent, String child)
6092N/A File testFile = new File(curName, "child");
6092N/A test(testFile);
6092N/A testFile = new File("parent", curName);
6092N/A test(testFile);
6092N/A
6092N/A // test File(String pathname)
6092N/A testFile = new File(curName);
6092N/A test(testFile);
6092N/A
6092N/A // test File(File parent, String child)
6092N/A testFile = new File(new File(curName), "child");
6092N/A test(testFile);
6092N/A testFile = new File(new File("parent"), curName);
6092N/A test(testFile);
6092N/A
6092N/A // test FileInputStream
6092N/A testFileInputStream(curName);
6092N/A
6092N/A // test FileOutputStream
6092N/A testFileOutputStream(curName);
6092N/A
6092N/A // test RandomAccessFile
6092N/A testRandomAccessFile(curName);
6092N/A }
6092N/A }
6092N/A
6092N/A private static void testFileInputStream(final String str) {
6092N/A boolean exceptionThrown = false;
6092N/A FileInputStream is = null;
6092N/A try {
6092N/A is = new FileInputStream(str);
6092N/A } catch (FileNotFoundException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("FileInputStream constructor"
6092N/A + " should throw FileNotFoundException");
6092N/A }
6092N/A if (is != null) {
6092N/A throw new RuntimeException("FileInputStream constructor"
6092N/A + " should fail");
6092N/A }
6092N/A
6092N/A exceptionThrown = false;
6092N/A is = null;
6092N/A try {
6092N/A is = new FileInputStream(new File(str));
6092N/A } catch (FileNotFoundException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("FileInputStream constructor"
6092N/A + " should throw FileNotFoundException");
6092N/A }
6092N/A if (is != null) {
6092N/A throw new RuntimeException("FileInputStream constructor"
6092N/A + " should fail");
6092N/A }
6092N/A }
6092N/A
6092N/A private static void testFileOutputStream(final String str) {
6092N/A boolean exceptionThrown = false;
6092N/A FileOutputStream os = null;
6092N/A try {
6092N/A os = new FileOutputStream(str);
6092N/A } catch (FileNotFoundException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("FileOutputStream constructor"
6092N/A + " should throw FileNotFoundException");
6092N/A }
6092N/A if (os != null) {
6092N/A throw new RuntimeException("FileOutputStream constructor"
6092N/A + " should fail");
6092N/A }
6092N/A
6092N/A exceptionThrown = false;
6092N/A os = null;
6092N/A try {
6092N/A os = new FileOutputStream(new File(str));
6092N/A } catch (FileNotFoundException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("FileOutputStream constructor"
6092N/A + " should throw FileNotFoundException");
6092N/A }
6092N/A if (os != null) {
6092N/A throw new RuntimeException("FileOutputStream constructor"
6092N/A + " should fail");
6092N/A }
6092N/A }
6092N/A
6092N/A private static void testRandomAccessFile(final String str) {
6092N/A boolean exceptionThrown = false;
6092N/A RandomAccessFile raf = null;
6092N/A String[] modes = {"r", "rw", "rws", "rwd"};
6092N/A
6092N/A for (String mode : modes) {
6092N/A try {
6092N/A raf = new RandomAccessFile(str, mode);
6092N/A } catch (FileNotFoundException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("RandomAccessFile constructor"
6092N/A + " should throw FileNotFoundException");
6092N/A }
6092N/A if (raf != null) {
6092N/A throw new RuntimeException("RandomAccessFile constructor"
6092N/A + " should fail");
6092N/A }
6092N/A
6092N/A exceptionThrown = false;
6092N/A raf = null;
6092N/A try {
6092N/A raf = new RandomAccessFile(new File(str), mode);
6092N/A } catch (FileNotFoundException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("RandomAccessFile constructor"
6092N/A + " should throw FileNotFoundException");
6092N/A }
6092N/A if (raf != null) {
6092N/A throw new RuntimeException("RandomAccessFile constructor"
6092N/A + " should fail");
6092N/A }
6092N/A }
6092N/A }
6092N/A
6092N/A private static void test(File testFile) {
6092N/A test(testFile, false);
6092N/A // test serialization
6092N/A testSerialization(testFile);
6092N/A }
6092N/A
6092N/A @SuppressWarnings("deprecation")
6092N/A private static void test(File testFile, boolean derived) {
6092N/A boolean exceptionThrown = false;
6092N/A
6092N/A if (testFile == null) {
6092N/A throw new RuntimeException("test file should not be null.");
6092N/A }
6092N/A
6092N/A // getPath()
6092N/A if (testFile.getPath().indexOf(CHAR_NUL) < 0) {
6092N/A throw new RuntimeException(
6092N/A "File path should contain Nul character");
6092N/A }
6092N/A // getAbsolutePath()
6092N/A if (testFile.getAbsolutePath().indexOf(CHAR_NUL) < 0) {
6092N/A throw new RuntimeException(
6092N/A "File absolute path should contain Nul character");
6092N/A }
6092N/A // getAbsoluteFile()
6092N/A File derivedAbsFile = testFile.getAbsoluteFile();
6092N/A if (derived) {
6092N/A if (derivedAbsFile.getPath().indexOf(CHAR_NUL) < 0) {
6092N/A throw new RuntimeException(
6092N/A "Derived file path should also contain Nul character");
6092N/A }
6092N/A } else {
6092N/A test(derivedAbsFile, true);
6092N/A }
6092N/A // getCanonicalPath()
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.getCanonicalPath();
6092N/A } catch (IOException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException(
6092N/A "getCanonicalPath() should throw IOException with"
6092N/A + " message \"" + ExceptionMsg + "\"");
6092N/A }
6092N/A // getCanonicalFile()
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.getCanonicalFile();
6092N/A } catch (IOException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException(
6092N/A "getCanonicalFile() should throw IOException with"
6092N/A + " message \"" + ExceptionMsg + "\"");
6092N/A }
6092N/A // toURL()
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.toURL();
6092N/A } catch (MalformedURLException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("toURL() should throw IOException with"
6092N/A + " message \"" + ExceptionMsg + "\"");
6092N/A }
6092N/A // canRead()
6092N/A if (testFile.canRead())
6092N/A throw new RuntimeException("File should not be readable");
6092N/A // canWrite()
6092N/A if (testFile.canWrite())
6092N/A throw new RuntimeException("File should not be writable");
6092N/A // exists()
6092N/A if (testFile.exists())
6092N/A throw new RuntimeException("File should not be existed");
6092N/A // isDirectory()
6092N/A if (testFile.isDirectory())
6092N/A throw new RuntimeException("File should not be a directory");
6092N/A // isFile()
6092N/A if (testFile.isFile())
6092N/A throw new RuntimeException("File should not be a file");
6092N/A // isHidden()
6092N/A if (testFile.isHidden())
6092N/A throw new RuntimeException("File should not be hidden");
6092N/A // lastModified()
6092N/A if (testFile.lastModified() != 0L)
6092N/A throw new RuntimeException("File last modified time should be 0L");
6092N/A // length()
6092N/A if (testFile.length() != 0L)
6092N/A throw new RuntimeException("File length should be 0L");
6092N/A // createNewFile()
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.createNewFile();
6092N/A } catch (IOException ex) {
6092N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException(
6092N/A "createNewFile() should throw IOException with"
6092N/A + " message \"" + ExceptionMsg + "\"");
6092N/A }
6092N/A // delete()
6092N/A if (testFile.delete())
6092N/A throw new RuntimeException("Delete operation should fail");
6092N/A // list()
6092N/A if (testFile.list() != null)
6092N/A throw new RuntimeException("File list() should return null");
6092N/A // list(FilenameFilter)
6092N/A FilenameFilter fnFilter = new FilenameFilter() {
6092N/A @Override
6092N/A public boolean accept(File dir, String name) {
6092N/A return false;
6092N/A }
6092N/A };
6092N/A if (testFile.list(fnFilter) != null) {
6092N/A throw new RuntimeException("File list(FilenameFilter) should"
6092N/A + " return null");
6092N/A }
6092N/A // listFiles()
6092N/A if (testFile.listFiles() != null)
6092N/A throw new RuntimeException("File listFiles() should return null");
6092N/A // listFiles(FilenameFilter)
6092N/A if (testFile.listFiles(fnFilter) != null) {
6092N/A throw new RuntimeException("File listFiles(FilenameFilter)"
6092N/A + " should return null");
6092N/A }
6092N/A // listFiles(FileFilter)
6092N/A FileFilter fFilter = new FileFilter() {
6092N/A @Override
6092N/A public boolean accept(File file) {
6092N/A return false;
6092N/A }
6092N/A };
6092N/A if (testFile.listFiles(fFilter) != null) {
6092N/A throw new RuntimeException("File listFiles(FileFilter)"
6092N/A + " should return null");
6092N/A }
6092N/A // mkdir()
6092N/A if (testFile.mkdir()) {
6092N/A throw new RuntimeException("File should not be able to"
6092N/A + " create directory");
6092N/A }
6092N/A // mkdirs()
6092N/A if (testFile.mkdirs()) {
6092N/A throw new RuntimeException("File should not be able to"
6092N/A + " create directories");
6092N/A }
6092N/A // renameTo(File)
6092N/A if (testFile.renameTo(new File("dest")))
6092N/A throw new RuntimeException("File rename should fail");
6092N/A if (new File("dest").renameTo(testFile))
6092N/A throw new RuntimeException("File rename should fail");
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.renameTo(null);
6092N/A } catch (NullPointerException ex) {
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("File rename should thrown NPE");
6092N/A }
6092N/A // setLastModified(long)
6092N/A if (testFile.setLastModified(0L)) {
6092N/A throw new RuntimeException("File should fail to set"
6092N/A + " last modified time");
6092N/A }
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.setLastModified(-1);
6092N/A } catch (IllegalArgumentException ex) {
6092N/A if ("Negative time".equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("File should fail to set"
6092N/A + " last modified time with message \"Negative time\"");
6092N/A }
6092N/A // setReadOnly()
6092N/A if (testFile.setReadOnly())
6092N/A throw new RuntimeException("File should fail to set read-only");
6092N/A // setWritable(boolean writable, boolean ownerOnly)
6092N/A if (testFile.setWritable(true, true))
6092N/A throw new RuntimeException("File should fail to set writable");
6092N/A if (testFile.setWritable(true, false))
6092N/A throw new RuntimeException("File should fail to set writable");
6092N/A if (testFile.setWritable(false, true))
6092N/A throw new RuntimeException("File should fail to set writable");
6092N/A if (testFile.setWritable(false, false))
6092N/A throw new RuntimeException("File should fail to set writable");
6092N/A // setWritable(boolean writable)
6092N/A if (testFile.setWritable(false))
6092N/A throw new RuntimeException("File should fail to set writable");
6092N/A if (testFile.setWritable(true))
6092N/A throw new RuntimeException("File should fail to set writable");
6092N/A // setReadable(boolean readable, boolean ownerOnly)
6092N/A if (testFile.setReadable(true, true))
6092N/A throw new RuntimeException("File should fail to set readable");
6092N/A if (testFile.setReadable(true, false))
6092N/A throw new RuntimeException("File should fail to set readable");
6092N/A if (testFile.setReadable(false, true))
6092N/A throw new RuntimeException("File should fail to set readable");
6092N/A if (testFile.setReadable(false, false))
6092N/A throw new RuntimeException("File should fail to set readable");
6092N/A // setReadable(boolean readable)
6092N/A if (testFile.setReadable(false))
6092N/A throw new RuntimeException("File should fail to set readable");
6092N/A if (testFile.setReadable(true))
6092N/A throw new RuntimeException("File should fail to set readable");
6092N/A // setExecutable(boolean executable, boolean ownerOnly)
6092N/A if (testFile.setExecutable(true, true))
6092N/A throw new RuntimeException("File should fail to set executable");
6092N/A if (testFile.setExecutable(true, false))
6092N/A throw new RuntimeException("File should fail to set executable");
6092N/A if (testFile.setExecutable(false, true))
6092N/A throw new RuntimeException("File should fail to set executable");
6092N/A if (testFile.setExecutable(false, false))
6092N/A throw new RuntimeException("File should fail to set executable");
6092N/A // setExecutable(boolean executable)
6092N/A if (testFile.setExecutable(false))
6092N/A throw new RuntimeException("File should fail to set executable");
6092N/A if (testFile.setExecutable(true))
6092N/A throw new RuntimeException("File should fail to set executable");
6092N/A // canExecute()
6092N/A if (testFile.canExecute())
6092N/A throw new RuntimeException("File should not be executable");
6092N/A // getTotalSpace()
6092N/A if (testFile.getTotalSpace() != 0L)
6092N/A throw new RuntimeException("The total space should be 0L");
6092N/A // getFreeSpace()
6092N/A if (testFile.getFreeSpace() != 0L)
6092N/A throw new RuntimeException("The free space should be 0L");
6092N/A // getUsableSpace()
6092N/A if (testFile.getUsableSpace() != 0L)
6092N/A throw new RuntimeException("The usable space should be 0L");
6092N/A // compareTo(File null)
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.compareTo(null);
6092N/A } catch (NullPointerException ex) {
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("compareTo(null) should throw NPE");
6092N/A }
6092N/A // toString()
6092N/A if (testFile.toString().indexOf(CHAR_NUL) < 0) {
6092N/A throw new RuntimeException(
6092N/A "File path should contain Nul character");
6092N/A }
6092N/A // toPath()
6092N/A try {
6092N/A exceptionThrown = false;
6092N/A testFile.toPath();
6092N/A } catch (InvalidPathException ex) {
6092N/A exceptionThrown = true;
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("toPath() should throw"
6092N/A + " InvalidPathException");
6092N/A }
6092N/A }
6092N/A
6092N/A private static void testSerialization(File testFile) {
6092N/A String path = testFile.getPath();
6092N/A try {
6092N/A // serialize test file
6092N/A ByteArrayOutputStream baos = new ByteArrayOutputStream();
6092N/A ObjectOutputStream oos = new ObjectOutputStream(baos);
6092N/A oos.writeObject(testFile);
6092N/A oos.close();
6092N/A // deserialize test file
6092N/A byte[] bytes = baos.toByteArray();
6092N/A ByteArrayInputStream is = new ByteArrayInputStream(bytes);
6092N/A ObjectInputStream ois = new ObjectInputStream(is);
6092N/A File newFile = (File) ois.readObject();
6092N/A // test
6092N/A String newPath = newFile.getPath();
6092N/A if (!path.equals(newPath)) {
6092N/A throw new RuntimeException(
6092N/A "Serialization should not change file path");
6092N/A }
6092N/A test(newFile, false);
6092N/A } catch (IOException | ClassNotFoundException ex) {
6092N/A System.err.println("Exception happens in testSerialization");
6092N/A System.err.println(ex.getMessage());
6092N/A }
6092N/A }
6092N/A
6092N/A private static void testTempFile() {
6092N/A final String[] names = {"x", "xx", "xxx", "xxxx"};
6092N/A final String shortPrefix = "sp";
6092N/A final String prefix = "prefix";
6092N/A final String suffix = "suffix";
6092N/A File tmpDir = new File("tmpDir");
6092N/A
6092N/A for (String name : names) {
6092N/A int length = name.length();
6092N/A for (int i = 0; i <= length; i++) {
6092N/A StringBuilder sbName = new StringBuilder(name);
6092N/A sbName.insert(i, CHAR_NUL);
6092N/A String curName = sbName.toString();
6092N/A
6092N/A // test prefix
6092N/A testCreateTempFile(curName, suffix, tmpDir);
6092N/A // test suffix
6092N/A testCreateTempFile(shortPrefix, curName, tmpDir);
6092N/A testCreateTempFile(prefix, curName, tmpDir);
6092N/A // test directory
6092N/A testCreateTempFile(shortPrefix, suffix, new File(curName));
6092N/A testCreateTempFile(prefix, suffix, new File(curName));
6092N/A }
6092N/A }
6092N/A }
6092N/A
6092N/A private static void testCreateTempFile(String prefix, String suffix,
6092N/A File directory) {
6092N/A // createTempFile(String prefix, String suffix, File directory)
6092N/A boolean exceptionThrown = false;
6092N/A boolean shortPrefix = (prefix.length() < 3);
6092N/A if (shortPrefix) {
6092N/A try {
6092N/A File.createTempFile(prefix, suffix, directory);
6092N/A } catch (IllegalArgumentException ex) {
6092N/A if ("Prefix string too short".equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A } catch (IOException ioe) {
6092N/A System.err.println("IOException happens in testCreateTempFile");
6092N/A System.err.println(ioe.getMessage());
6092N/A }
6092N/A } else {
6092N/A try {
6092N/A File.createTempFile(prefix, suffix, directory);
6092N/A } catch (IOException ex) {
6156N/A if (ExceptionMsg.equals(ex.getMessage()))
6092N/A exceptionThrown = true;
6092N/A }
6092N/A }
6092N/A if (!exceptionThrown) {
6092N/A throw new RuntimeException("createTempFile() should throw"
6092N/A + (shortPrefix ? " IllegalArgumentException"
6092N/A : " IOException"));
6092N/A }
6092N/A }
6092N/A}