Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 93414 invoked from network); 3 Jan 2008 04:10:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Jan 2008 04:10:39 -0000 Received: (qmail 81396 invoked by uid 500); 3 Jan 2008 04:10:27 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 81365 invoked by uid 500); 3 Jan 2008 04:10:27 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 32297 invoked by uid 99); 29 Dec 2007 19:53:47 -0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of paranoiabla@gmail.com designates 209.85.146.182 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=Muj9Joj7+MNXOpCeFgAdPJsvbiCPgz/r7xCVpWVK2Po=; b=FZvpl3gCiMC4qi9S4nlrunPnhelhnNAKG+8BYEq8HsHIlAnmECAQU1zfwtCcTqBuXpjaZQzT+haUb4EDP/lm6hC/3xQEQTfCT06pBOdMAGBHr5y6stFEqaGPhof0VVXosB/GTTgM4PsYl5/ojNvt5D4NiU+rCSqHTNqKpdZSGJ4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=ZLSYM5b7zUiAIOJSFLMQTOPawlkIEmTl4pnMnkWx1soh8bi1wUsJD9zQICibp4mbQSOzHxgkyEvxOaK6wFNKg1TxGH4pS130wjRoUfWSxdWb7qAmdrfm5CdGeABujKX1N1yehHj7oReARQUrXcCaNPzyxj8xXX2CgpSZr0QBJmM= Message-ID: Date: Sat, 29 Dec 2007 21:53:22 +0200 From: "Petar Tahchiev" To: dev@ant.apache.org Subject: Bug In org.apache.tools.ant.util.FileUtils MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_19844_10570345.1198958002465" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_19844_10570345.1198958002465 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi guys, here is Petar Tahchiev from the Jakarta Cactus Team. I found that the current version of cactus's tasks cannot work with Ant 1.8.0alpha. When Trying to execute our tasks I get this exception: java.io.FileNotFoundException: /home/peter/workspace/Cactus/cactus13879tmp.dir/web.xml (Not a directory) at java.io.FileOutputStream.open(Native Method) at java.io.FileOutputStream.(FileOutputStream.java:179) at java.io.FileOutputStream.(FileOutputStream.java:131) at org.codehaus.cargo.module.AbstractDescriptorIo.writeDescriptor( AbstractDescriptorIo.java:110) We are using FileUtils from Ant to create a temporary directory to store some data, and the point is that from some time the FileUtils's method createTemFile changed its body. Now it is: ---------------------------------------------------------------------------------------------------------------------- public File createTempFile(String prefix, String suffix, File parentDir, boolean deleteOnExit) { File result = null; String parent = (parentDir == null) ? System.getProperty("java.io.tmpdir") : parentDir.getPath(); try { result = File.createTempFile(prefix, suffix, new File(parent)); } catch (IOException e) { throw new BuildException("Could not create tempfile in " + parent, e); } if (deleteOnExit) { result.deleteOnExit(); } return result; } ------------------------------------------------------------------------------------------------------------------- and it used to be: ------------------------------------------- public File createTempFile(String prefix, String suffix, File parentDir, boolean deleteOnExit) { File result = null; String parent = (parentDir == null) ? System.getProperty("java.io.tmpdir") : parentDir.getPath(); DecimalFormat fmt = new DecimalFormat("#####"); synchronized (rand) { do { result = new File(parent, prefix + fmt.format(Math.abs(rand.nextInt())) + suffix); } while (result.exists()); } if (deleteOnExit) { result.deleteOnExit(); } return result; } ------------------------------------------- You see now the new file uses "File.createTempFile" to create the temp file. And here comes the problem, we use the createTempFile method to create directories. According to the Javadoc API: File.createTempFile - Creates an empty file in the default temporary-file directory, using the given prefix and suffix to generate its name. So every time it creates a file, instead of a directory, no matter if I say tempFile.mkdirs(); !!! I can implement the method I need myself, but I think that the clearer approach would be, you guys to bring back the old implementation of the method in the FileUtils, because there might be some other guys that use it to create a temporary folder. Hope I explained it well and didn't confuse you. Please let me know what you think, and keep me posted on CC, because I am not subscribed to dev@ant.apache.org. Thanks and have a good evening. -- Regards, Petar! Karlovo, Bulgaria. EOOXML Objections http://www.grokdoc.net/index.php/EOOXML_objections Public PGP Key at: https://keyserver1.pgp.com/vkd/DownloadKey.event?keyid=0x19658550C3110611 Key Fingerprint: A369 A7EE 61BC 93A3 CDFF 55A5 1965 8550 C311 0611 ------=_Part_19844_10570345.1198958002465--