Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@www.apache.org Received: (qmail 49371 invoked from network); 18 May 2004 13:42:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 18 May 2004 13:42:52 -0000 Received: (qmail 73049 invoked by uid 500); 18 May 2004 13:42:44 -0000 Delivered-To: apmail-jakarta-lucene-dev-archive@jakarta.apache.org Received: (qmail 72928 invoked by uid 500); 18 May 2004 13:42:44 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 72737 invoked by uid 500); 18 May 2004 13:42:42 -0000 Received: (qmail 72711 invoked by uid 98); 18 May 2004 13:42:42 -0000 Received: from otis@apache.org by hermes.apache.org by uid 82 with qmail-scanner-1.20 (clamuko: 0.70. Clear:RC:0(209.237.227.194):. Processed in 0.036187 secs); 18 May 2004 13:42:42 -0000 X-Qmail-Scanner-Mail-From: otis@apache.org via hermes.apache.org X-Qmail-Scanner: 1.20 (Clear:RC:0(209.237.227.194):. Processed in 0.036187 secs) Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by hermes.apache.org with SMTP; 18 May 2004 13:42:41 -0000 Received: (qmail 48886 invoked by uid 1371); 18 May 2004 13:42:30 -0000 Date: 18 May 2004 13:42:30 -0000 Message-ID: <20040518134230.48885.qmail@minotaur.apache.org> From: otis@apache.org To: jakarta-lucene-cvs@apache.org Subject: cvs commit: jakarta-lucene/src/java/org/apache/lucene/store FSDirectory.java X-Spam-Rating: hermes.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N otis 2004/05/18 06:42:30 Modified: src/java/org/apache/lucene/store FSDirectory.java Log: - Patch for 28074: http://issues.apache.org/bugzilla/show_bug.cgi?id=28074 and minor exception message text changes Revision Changes Path 1.31 +13 -8 jakarta-lucene/src/java/org/apache/lucene/store/FSDirectory.java Index: FSDirectory.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/store/FSDirectory.java,v retrieving revision 1.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- FSDirectory.java 11 May 2004 20:01:48 -0000 1.30 +++ FSDirectory.java 18 May 2004 13:42:30 -0000 1.31 @@ -122,6 +122,11 @@ if (!lockDir.isAbsolute()) { lockDir = new File(directory, LOCK_DIR); } + if (lockDir.exists() == false) { + if (lockDir.mkdirs() == false) { + throw new IOException("Cannot create lock directory: " + lockDir); + } + } if (create) create(); @@ -132,13 +137,13 @@ private synchronized void create() throws IOException { if (!directory.exists()) if (!directory.mkdirs()) - throw new IOException("Cannot create directory: " + directory); + throw new IOException("Cannot create lock directory: " + directory); String[] files = directory.list(); // clear old files for (int i = 0; i < files.length; i++) { File file = new File(directory, files[i]); if (!file.delete()) - throw new IOException("couldn't delete " + files[i]); + throw new IOException("Cannot delete " + files[i]); } String lockPrefix = getLockPrefix().toString(); // clear old locks @@ -148,7 +153,7 @@ continue; File lockFile = new File(lockDir, files[i]); if (!lockFile.delete()) - throw new IOException("couldn't delete " + files[i]); + throw new IOException("Cannot delete " + files[i]); } } @@ -192,7 +197,7 @@ public final void deleteFile(String name) throws IOException { File file = new File(directory, name); if (!file.delete()) - throw new IOException("couldn't delete " + name); + throw new IOException("Cannot delete " + name); } /** Renames an existing file in the directory. */ @@ -207,7 +212,7 @@ if (nu.exists()) if (!nu.delete()) - throw new IOException("couldn't delete " + to); + throw new IOException("Cannot delete " + to); // Rename the old file to the new one. Unfortunately, the renameTo() // method does not work reliably under some JVMs. Therefore, if the @@ -233,21 +238,21 @@ old.delete(); } catch (IOException ioe) { - throw new IOException("couldn't rename " + from + " to " + to); + throw new IOException("Cannot rename " + from + " to " + to); } finally { if (in != null) { try { in.close(); } catch (IOException e) { - throw new RuntimeException("could not close input stream: " + e.getMessage()); + throw new RuntimeException("Cannot close input stream: " + e.getMessage()); } } if (out != null) { try { out.close(); } catch (IOException e) { - throw new RuntimeException("could not close output stream: " + e.getMessage()); + throw new RuntimeException("Cannot close output stream: " + e.getMessage()); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-dev-help@jakarta.apache.org