hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cutt...@apache.org
Subject svn commit: r417270 - /lucene/hadoop/trunk/src/examples/org/apache/hadoop/examples/RandomWriter.java
Date Mon, 26 Jun 2006 18:22:37 GMT
Author: cutting
Date: Mon Jun 26 11:22:36 2006
New Revision: 417270

URL: http://svn.apache.org/viewvc?rev=417270&view=rev
Log:
HADOOP-301.  In RandomWriter example, don't overwrite output directory
if it already exists.  Contributed by Owen.

Modified:
    lucene/hadoop/trunk/src/examples/org/apache/hadoop/examples/RandomWriter.java

Modified: lucene/hadoop/trunk/src/examples/org/apache/hadoop/examples/RandomWriter.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/examples/org/apache/hadoop/examples/RandomWriter.java?rev=417270&r1=417269&r2=417270&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/examples/org/apache/hadoop/examples/RandomWriter.java (original)
+++ lucene/hadoop/trunk/src/examples/org/apache/hadoop/examples/RandomWriter.java Mon Jun
26 11:22:36 2006
@@ -177,8 +177,12 @@
     Path inDir = new Path(tmpDir, "in");
     Path fakeOutDir = new Path(tmpDir, "out");
     FileSystem fileSys = FileSystem.get(jobConf);
+    if (fileSys.exists(outDir)) {
+      System.out.println("Error: Output directory " + outDir + 
+                         " already exists.");
+      return;
+    }
     fileSys.delete(tmpDir);
-    fileSys.delete(outDir);
     fileSys.mkdirs(inDir);
     NumberFormat numberFormat = NumberFormat.getInstance();
     numberFormat.setMinimumIntegerDigits(6);



Mime
View raw message