mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r1386734 - /mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
Date Mon, 17 Sep 2012 17:26:20 GMT
Author: srowen
Date: Mon Sep 17 17:26:19 2012
New Revision: 1386734

URL: http://svn.apache.org/viewvc?rev=1386734&view=rev
Log:
MAHOUT-166 ignore directories inside update file directory

Modified:
    mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java

Modified: mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java?rev=1386734&r1=1386733&r2=1386734&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
(original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/cf/taste/impl/model/file/FileDataModel.java
Mon Sep 17 17:26:19 2012
@@ -18,6 +18,7 @@
 package org.apache.mahout.cf.taste.impl.model.file;
 
 import java.io.File;
+import java.io.FileFilter;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Collection;
@@ -293,7 +294,13 @@ public class FileDataModel extends Abstr
     String startName = period < 0 ? dataFileName : dataFileName.substring(0, period);
     File parentDir = dataFile.getParentFile();
     Map<Long, File> modTimeToUpdateFile = new TreeMap<Long,File>();
-    for (File updateFile : parentDir.listFiles()) {
+    FileFilter onlyFiles = new FileFilter() {
+      @Override
+      public boolean accept(File file) {
+        return !file.isDirectory();
+      }
+    };
+    for (File updateFile : parentDir.listFiles(onlyFiles)) {
       String updateFileName = updateFile.getName();
       if (updateFileName.startsWith(startName)
           && !updateFileName.equals(dataFileName)



Mime
View raw message