HBASE-16145 MultiRowRangeFilter constructor shouldn't throw IOException (Konstantin Ryakhovskiy)

This commit is contained in:
tedyu 2016-10-17 16:06:10 -07:00
parent 0c304a049b
commit 10840a51e8
3 changed files with 4 additions and 21 deletions

View File

@ -17,7 +17,6 @@
*/ */
package org.apache.hadoop.hbase.filter; package org.apache.hadoop.hbase.filter;
import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@ -64,11 +63,8 @@ public class MultiRowRangeFilter extends FilterBase {
/** /**
* @param list A list of <code>RowRange</code> * @param list A list of <code>RowRange</code>
* @throws java.io.IOException
* throw an exception if the range list is not in an natural order or any
* <code>RowRange</code> is invalid
*/ */
public MultiRowRangeFilter(List<RowRange> list) throws IOException { public MultiRowRangeFilter(List<RowRange> list) {
this.rangeList = sortAndMerge(list); this.rangeList = sortAndMerge(list);
} }
@ -184,11 +180,7 @@ public class MultiRowRangeFilter extends FilterBase {
rangeProto.getStopRow().toByteArray() : null, rangeProto.getStopRowInclusive()); rangeProto.getStopRow().toByteArray() : null, rangeProto.getStopRowInclusive());
rangeList.add(range); rangeList.add(range);
} }
try { return new MultiRowRangeFilter(rangeList);
return new MultiRowRangeFilter(rangeList);
} catch (IOException e) {
throw new DeserializationException("Fail to instantiate the MultiRowRangeFilter", e);
}
} }
/** /**

View File

@ -407,11 +407,7 @@ public class ScannerModel implements ProtobufMessageHandler, Serializable {
filter = new MultipleColumnPrefixFilter(values); filter = new MultipleColumnPrefixFilter(values);
} break; } break;
case MultiRowRangeFilter: { case MultiRowRangeFilter: {
try { filter = new MultiRowRangeFilter(ranges);
filter = new MultiRowRangeFilter(ranges);
} catch (IOException e) {
throw new RuntimeException(e);
}
} break; } break;
case PageFilter: case PageFilter:
filter = new PageFilter(Long.parseLong(value)); filter = new PageFilter(Long.parseLong(value));

View File

@ -207,12 +207,7 @@ public class RowCounter extends Configured implements Tool {
scan.setStartRow(range.getStartRow()); //inclusive scan.setStartRow(range.getStartRow()); //inclusive
scan.setStopRow(range.getStopRow()); //exclusive scan.setStopRow(range.getStopRow()); //exclusive
} else if (size > 1) { } else if (size > 1) {
try { scan.setFilter(new MultiRowRangeFilter(rowRangeList));
scan.setFilter(new MultiRowRangeFilter(rowRangeList));
} catch (IOException e) {
//the IOException should never be thrown. see HBASE-16145
throw new RuntimeException("Cannot instantiate MultiRowRangeFilter");
}
} }
} }