From ftpserver-commits-return-222-apmail-incubator-ftpserver-commits-archive=incubator.apache.org@incubator.apache.org Tue Sep 11 20:08:57 2007 Return-Path: Delivered-To: apmail-incubator-ftpserver-commits-archive@www.apache.org Received: (qmail 10723 invoked from network); 11 Sep 2007 20:08:55 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Sep 2007 20:08:55 -0000 Received: (qmail 34596 invoked by uid 500); 11 Sep 2007 20:08:48 -0000 Delivered-To: apmail-incubator-ftpserver-commits-archive@incubator.apache.org Received: (qmail 34571 invoked by uid 500); 11 Sep 2007 20:08:48 -0000 Mailing-List: contact ftpserver-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ftpserver-dev@incubator.apache.org Delivered-To: mailing list ftpserver-commits@incubator.apache.org Received: (qmail 34560 invoked by uid 99); 11 Sep 2007 20:08:48 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 13:08:48 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 20:08:53 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 4D3A41A9832; Tue, 11 Sep 2007 13:08:33 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r574682 - in /incubator/ftpserver/trunk/core/src: java/org/apache/ftpserver/command/STOU.java test/org/apache/ftpserver/clienttests/StoreTest.java Date: Tue, 11 Sep 2007 20:08:32 -0000 To: ftpserver-commits@incubator.apache.org From: ngn@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20070911200833.4D3A41A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ngn Date: Tue Sep 11 13:08:32 2007 New Revision: 574682 URL: http://svn.apache.org/viewvc?rev=574682&view=rev Log: Fixed broken STOU command when a full file path is provided as an argument (FTPSERVER-107) Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STOU.java incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/StoreTest.java Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STOU.java URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STOU.java?rev=574682&r1=574681&r2=574682&view=diff ============================================================================== --- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STOU.java (original) +++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/STOU.java Tue Sep 11 13:08:32 2007 @@ -86,18 +86,23 @@ return; } - String dirName = request.getArgument(); - - String filePrefix; - if(dirName == null) { - filePrefix = "ftp.dat"; - } else { - filePrefix = dirName + "/ftp.dat"; - } + String pathName = request.getArgument(); // get filenames FileObject file = null; try { + String filePrefix; + if(pathName == null) { + filePrefix = "ftp.dat"; + } else { + FileObject dir = session.getFileSystemView().getFileObject(pathName); + if(dir.isDirectory()) { + filePrefix = pathName + "/ftp.dat"; + } else { + filePrefix = pathName; + } + } + file = session.getFileSystemView().getFileObject(filePrefix); if(file != null) { file = getUniqueFile(connection, session, file); @@ -106,6 +111,7 @@ catch(Exception ex) { LOG.debug("Exception getting file object", ex); } + if(file == null) { out.write(FtpReplyUtil.translate(session, FtpReply.REPLY_550_REQUESTED_ACTION_NOT_TAKEN, "STOU", null)); return; Modified: incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/StoreTest.java URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/StoreTest.java?rev=574682&r1=574681&r2=574682&view=diff ============================================================================== --- incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/StoreTest.java (original) +++ incubator/ftpserver/trunk/core/src/test/org/apache/ftpserver/clienttests/StoreTest.java Tue Sep 11 13:08:32 2007 @@ -155,6 +155,16 @@ doAssertOfUniqueFile(client, ROOT_DIR); } + public void testStoreUniqueWithCompletePath() throws Exception { + TEST_DIR.mkdirs(); + File existingFile = new File(TEST_DIR, "existingFile.txt"); + existingFile.createNewFile(); + + assertTrue(client.storeUniqueFile("foo/bar/existingFile.txt", new ByteArrayInputStream(testData))); + + doAssertOfUniqueFile(client, ROOT_DIR); + } + public void testStoreUniqueWithDirectory() throws Exception { TEST_DIR.mkdirs();