cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r788510 - in /incubator/cassandra/trunk/src/java/org/apache/cassandra/db: Column.java ColumnFamily.java SuperColumn.java
Date Thu, 25 Jun 2009 21:07:37 GMT
Author: jbellis
Date: Thu Jun 25 21:07:35 2009
New Revision: 788510

URL: http://svn.apache.org/viewvc?rev=788510&view=rev
Log:
add asserts.  patch by jbellis; reviewed by Sandeep Tata for CASSANDRA-255

Modified:
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java
    incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java?rev=788510&r1=788509&r2=788510&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/Column.java Thu Jun 25 21:07:35
2009
@@ -245,8 +245,7 @@
      */
     public IColumn deserialize(DataInputStream dis, IFilter filter) throws IOException
     {
-        if ( dis.available() == 0 )
-            return null;
+        assert dis.available() > 0;
 
         String name = dis.readUTF();
         IColumn column = new Column(name);
@@ -271,8 +270,7 @@
      */
     public IColumn deserialize(DataInputStream dis, String columnName, IFilter filter) throws
IOException
     {
-        if ( dis.available() == 0 )
-            return null;
+        assert dis.available() > 0;
         IColumn column = null;
         String name = dis.readUTF();
         if ( name.equals(columnName) )
@@ -313,6 +311,4 @@
         int size = dis.readInt();
         dis.skip(size);
     }
-
 }
-

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java?rev=788510&r1=788509&r2=788510&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/ColumnFamily.java Thu Jun 25
21:07:35 2009
@@ -512,10 +512,7 @@
             for (int i = 0; i < size; ++i)
             {
                 column = cf.getColumnSerializer().deserialize(dis);
-                if (column != null)
-                {
-                    cf.addColumn(column);
-                }
+                cf.addColumn(column);
             }
             return cf;
         }
@@ -535,7 +532,6 @@
                 if(column != null)
                 {
                     cf.addColumn(column);
-                    column = null;
                     if(filter.isDone())
                     {
                         break;

Modified: incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java?rev=788510&r1=788509&r2=788510&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java (original)
+++ incubator/cassandra/trunk/src/java/org/apache/cassandra/db/SuperColumn.java Thu Jun 25
21:07:35 2009
@@ -362,7 +362,7 @@
 
     private void fillSuperColumn(IColumn superColumn, DataInputStream dis) throws IOException
     {
-        assert dis.available() != 0;
+        assert dis.available() > 0;
 
         /* read the number of columns */
         int size = dis.readInt();
@@ -377,8 +377,7 @@
 
     public IColumn deserialize(DataInputStream dis, IFilter filter) throws IOException
     {
-        if ( dis.available() == 0 )
-            return null;
+        assert dis.available() > 0;
 
         IColumn superColumn = defreezeSuperColumn(dis);
         superColumn = filter.filter(superColumn, dis);
@@ -404,8 +403,7 @@
     */
     public IColumn deserialize(DataInputStream dis, String name, IFilter filter) throws IOException
     {
-        if ( dis.available() == 0 )
-            return null;
+        assert dis.available() > 0;
 
         String[] names = RowMutation.getColumnAndColumnFamily(name);
         if ( names.length == 1 )
@@ -424,7 +422,6 @@
                     if(column != null)
                     {
                         superColumn.addColumn(column);
-                        column = null;
                         if(filter.isDone())
                         {
                             break;



Mime
View raw message