cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r758969 - /incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java
Date Fri, 27 Mar 2009 02:18:50 GMT
Author: jbellis
Date: Fri Mar 27 02:18:50 2009
New Revision: 758969

URL: http://svn.apache.org/viewvc?rev=758969&view=rev
Log:
make local copy of NamesFilter names; modifying caller's List is buggy

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java?rev=758969&r1=758968&r2=758969&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/NamesFilter.java Fri Mar 27 02:18:50
2009
@@ -32,13 +32,13 @@
 public class NamesFilter implements IFilter
 {
     /* list of column names to filter against. */
-    private List<String> names_ = new ArrayList<String>();  
-    
+    private List<String> names_;
+
     NamesFilter(List<String> names)
     {
-        names_ = names;     
+        names_ = new ArrayList<String>(names);
     }
-    
+
     public ColumnFamily filter(String cf, ColumnFamily columnFamily)
     {
         if ( columnFamily == null )
@@ -55,7 +55,7 @@
 			{
 		        if ( names_.contains(column.name()) )
 		        {
-		            names_.remove(column.name());            
+		            names_.remove(column.name());
 					filteredCf.addColumn(column);
 		        }
 				if( isDone() )
@@ -64,20 +64,20 @@
 				}
 			}
 		}
-		else if ( values.length == 2 && DatabaseDescriptor.getColumnType(cfName).equals("Super")
)
+		else if ( values.length == 2 && DatabaseDescriptor.getColumnType(cfName).equals("Super"))
 		{
     		Collection<IColumn> columns = columnFamily.getAllColumns();
     		for(IColumn column : columns)
     		{
     			SuperColumn superColumn = (SuperColumn)column;
-                SuperColumn filteredSuperColumn = new SuperColumn(superColumn.name());
-                filteredCf.addColumn(filteredSuperColumn);
+    			SuperColumn filteredSuperColumn = new SuperColumn(superColumn.name());
+				filteredCf.addColumn(filteredSuperColumn);
         		Collection<IColumn> subColumns = superColumn.getSubColumns();
         		for(IColumn subColumn : subColumns)
         		{
     		        if ( names_.contains(subColumn.name()) )
     		        {
-    		            names_.remove(subColumn.name());            
+    		            names_.remove(subColumn.name());
     		            filteredSuperColumn.addColumn(subColumn.name(), subColumn);
     		        }
     				if( isDone() )
@@ -87,28 +87,28 @@
     			}
     		}
 		}
-    	else 
+    	else
     	{
     		throw new UnsupportedOperationException();
     	}
 		return filteredCf;
     }
-    
+
     public IColumn filter(IColumn column, DataInputStream dis) throws IOException
-    {       
+    {
         String columnName = column.name();
         if ( names_.contains(columnName) )
         {
-            names_.remove(columnName);            
+            names_.remove(columnName);
         }
         else
         {
             column = null;
         }
-        
+
         return column;
     }
-    
+
     public boolean isDone()
     {
         return names_.isEmpty();



Mime
View raw message