HBASE-6431 Some FilterList Constructors break addFilter (Alex Newman)
git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1366198 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a5bd687531
commit
b358b89351
|
@ -74,7 +74,11 @@ public class FilterList implements Filter {
|
|||
* @param rowFilters list of filters
|
||||
*/
|
||||
public FilterList(final List<Filter> rowFilters) {
|
||||
this.filters = rowFilters;
|
||||
if (rowFilters instanceof ArrayList) {
|
||||
this.filters = rowFilters;
|
||||
} else {
|
||||
this.filters = new ArrayList<Filter>(rowFilters);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -83,7 +87,7 @@ public class FilterList implements Filter {
|
|||
* @param rowFilters
|
||||
*/
|
||||
public FilterList(final Filter... rowFilters) {
|
||||
this.filters = Arrays.asList(rowFilters);
|
||||
this.filters = new ArrayList<Filter>(Arrays.asList(rowFilters));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,7 +106,7 @@ public class FilterList implements Filter {
|
|||
* @param rowFilters Set of row filters.
|
||||
*/
|
||||
public FilterList(final Operator operator, final List<Filter> rowFilters) {
|
||||
this.filters = rowFilters;
|
||||
this.filters = new ArrayList<Filter>(rowFilters);
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
|
@ -113,7 +117,7 @@ public class FilterList implements Filter {
|
|||
* @param rowFilters Filters to use
|
||||
*/
|
||||
public FilterList(final Operator operator, final Filter... rowFilters) {
|
||||
this.filters = Arrays.asList(rowFilters);
|
||||
this.filters = new ArrayList<Filter>(Arrays.asList(rowFilters));
|
||||
this.operator = operator;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,27 @@ public class TestFilterList {
|
|||
static byte[] GOOD_BYTES = Bytes.toBytes("abc");
|
||||
static byte[] BAD_BYTES = Bytes.toBytes("def");
|
||||
|
||||
|
||||
@Test
|
||||
public void testAddFilter() throws Exception {
|
||||
Filter filter1 = new RowFilter();
|
||||
Filter filter2 = new RowFilter();
|
||||
|
||||
FilterList filterList = new FilterList(filter1, filter2);
|
||||
filterList.addFilter(new RowFilter());
|
||||
|
||||
filterList = new FilterList(Arrays.asList(filter1, filter2));
|
||||
filterList.addFilter(new RowFilter());
|
||||
|
||||
filterList = new FilterList(Operator.MUST_PASS_ALL, filter1, filter2);
|
||||
filterList.addFilter(new RowFilter());
|
||||
|
||||
filterList = new FilterList(Operator.MUST_PASS_ALL, Arrays.asList(filter1, filter2));
|
||||
filterList.addFilter(new RowFilter());
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test "must pass one"
|
||||
* @throws Exception
|
||||
|
|
Loading…
Reference in New Issue