Author: aching
Date: Wed Mar 21 05:59:35 2012
New Revision: 1303293

URL: http://svn.apache.org/viewvc?rev=1303293&view=rev
Log:
GIRAPH-161 - Handling null messages and edges when initializing
IntIntNullIntVertex (dlogothetis via aching).

Modified:
    incubator/giraph/trunk/CHANGELOG
    
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/IntIntNullIntVertex.java

Modified: incubator/giraph/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/incubator/giraph/trunk/CHANGELOG?rev=1303293&r1=1303292&r2=1303293&view=diff
==============================================================================
--- incubator/giraph/trunk/CHANGELOG (original)
+++ incubator/giraph/trunk/CHANGELOG Wed Mar 21 05:59:35 2012
@@ -2,6 +2,9 @@ Giraph Change Log
 
 Release 0.2.0 - unreleased
 
+  GIRAPH-161 - Handling null messages and edges when initializing
+  IntIntNullIntVertex (dlogothetis via aching).
+
   GIRAPH-156: Users should be able to set simple 'custom arguments'
   via org.apache.giraph.GiraphRunner (ssc)
 

Modified: 
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/IntIntNullIntVertex.java
URL: 
http://svn.apache.org/viewvc/incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/IntIntNullIntVertex.java?rev=1303293&r1=1303292&r2=1303293&view=diff
==============================================================================
--- 
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/IntIntNullIntVertex.java
 (original)
+++ 
incubator/giraph/trunk/src/main/java/org/apache/giraph/graph/IntIntNullIntVertex.java
 Wed Mar 21 05:59:35 2012
@@ -51,15 +51,19 @@ public abstract class IntIntNullIntVerte
       Iterable<IntWritable> messages) {
     id = vertexId.get();
     value = vertexValue.get();
-    this.neighbors = new int[edges.size()];
+    this.neighbors = new int[(edges != null) ? edges.size() : 0];
     int n = 0;
-    for (IntWritable neighbor : edges.keySet()) {
-      this.neighbors[n++] = neighbor.get();
+    if (edges != null) {
+      for (IntWritable neighbor : edges.keySet()) {
+        this.neighbors[n++] = neighbor.get();
+      }
     }
-    this.messages = new int[Iterables.size(messages)];
-    n = 0;
-    for (IntWritable message : messages) {
-      this.messages[n++] = message.get();
+    this.messages = new int[(messages != null) ? Iterables.size(messages) : 0];
+    if (messages != null) {
+      n = 0;
+      for (IntWritable message : messages) {
+        this.messages[n++] = message.get();
+      }
     }
   }
 


Reply via email to