incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r828003 - in /incubator/hama/branches/0.19/src/java/org/apache/hama: DenseMatrix.java util/BytesUtil.java
Date Wed, 21 Oct 2009 13:05:20 GMT
Author: edwardyoon
Date: Wed Oct 21 13:05:20 2009
New Revision: 828003

URL: http://svn.apache.org/viewvc?rev=828003&view=rev
Log:
When the index is zero, BytesUtil.getRowIndex will throws the IndexOutOfBound

Modified:
    incubator/hama/branches/0.19/src/java/org/apache/hama/DenseMatrix.java
    incubator/hama/branches/0.19/src/java/org/apache/hama/util/BytesUtil.java

Modified: incubator/hama/branches/0.19/src/java/org/apache/hama/DenseMatrix.java
URL: http://svn.apache.org/viewvc/incubator/hama/branches/0.19/src/java/org/apache/hama/DenseMatrix.java?rev=828003&r1=828002&r2=828003&view=diff
==============================================================================
--- incubator/hama/branches/0.19/src/java/org/apache/hama/DenseMatrix.java (original)
+++ incubator/hama/branches/0.19/src/java/org/apache/hama/DenseMatrix.java Wed Oct 21 13:05:20
2009
@@ -356,7 +356,7 @@
     MapWritable trunk = new MapWritable();
 
     for (RowResult row : scan) {
-      trunk.put(new IntWritable(BytesUtil.bytesToInt(row.getRow())),
+      trunk.put(new IntWritable(BytesUtil.getRowIndex(row.getRow())),
           new DoubleEntry(row.get(columnKey)));
     }
 

Modified: incubator/hama/branches/0.19/src/java/org/apache/hama/util/BytesUtil.java
URL: http://svn.apache.org/viewvc/incubator/hama/branches/0.19/src/java/org/apache/hama/util/BytesUtil.java?rev=828003&r1=828002&r2=828003&view=diff
==============================================================================
--- incubator/hama/branches/0.19/src/java/org/apache/hama/util/BytesUtil.java (original)
+++ incubator/hama/branches/0.19/src/java/org/apache/hama/util/BytesUtil.java Wed Oct 21 13:05:20
2009
@@ -82,6 +82,10 @@
    */
   public static int getRowIndex(byte[] bytes) {
     String rKey = new String(bytes);
+    // return zero If all zero
+    if(rKey.equals("000000000000000")) {
+      return 0;
+    }
     
     if(rKey.substring(0, 8).equals("00000000")){
       int i = 8;



Mime
View raw message