mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeast...@apache.org
Subject svn commit: r1348493 - /mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java
Date Sat, 09 Jun 2012 20:03:10 GMT
Author: jeastman
Date: Sat Jun  9 20:03:10 2012
New Revision: 1348493

URL: http://svn.apache.org/viewvc?rev=1348493&view=rev
Log:
MAHOUT-1030: adding better null check when empty properties are written

Modified:
    mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java

Modified: mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java
URL: http://svn.apache.org/viewvc/mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java?rev=1348493&r1=1348492&r2=1348493&view=diff
==============================================================================
--- mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java
(original)
+++ mahout/trunk/integration/src/main/java/org/apache/mahout/utils/clustering/ClusterDumperWriter.java
Sat Jun  9 20:03:10 2012
@@ -80,14 +80,15 @@ public class ClusterDumperWriter extends
           WeightedPropertyVectorWritable tmp = (WeightedPropertyVectorWritable) point;
           Map<Text,Text> map = tmp.getProperties();
           // map can be null since empty maps when written are returned as null
-          if (map == null) break;
-          writer.write(" : [");
-          for (Map.Entry<Text,Text> entry : map.entrySet()) {
-            writer.write(entry.getKey().toString());
-            writer.write("=");
-            writer.write(entry.getValue().toString());
+          if (map != null) {
+            writer.write(" : [");
+            for (Map.Entry<Text,Text> entry : map.entrySet()) {
+              writer.write(entry.getKey().toString());
+              writer.write("=");
+              writer.write(entry.getValue().toString());
+            }
+            writer.write("]");
           }
-          writer.write("]");
         }
         
         writer.write(": ");



Mime
View raw message