HBASE-15283 Revert to IOException in TimeRange constructor to maintain API compat in 1.x line
[branch-1 and branch-1.2 only] HBASE-14355 changed the type of exception thrown if an invalid TimeRange is specified. This reverts to 1.1.x semantics.
This commit is contained in:
parent
455e09c325
commit
2e1a3ef644
|
@ -17,6 +17,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.hadoop.hbase.client;
|
package org.apache.hadoop.hbase.client;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
|
@ -192,8 +193,12 @@ public abstract class Query extends OperationWithAttributes {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public Query setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
|
public Query setColumnFamilyTimeRange(byte[] cf, long minStamp, long maxStamp) {
|
||||||
|
try {
|
||||||
colFamTimeRangeMap.put(cf, new TimeRange(minStamp, maxStamp));
|
colFamTimeRangeMap.put(cf, new TimeRange(minStamp, maxStamp));
|
||||||
return this;
|
return this;
|
||||||
|
} catch (IOException ioe) {
|
||||||
|
throw new IllegalArgumentException(ioe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -43,7 +43,9 @@ public class TimeRange {
|
||||||
/**
|
/**
|
||||||
* Default constructor.
|
* Default constructor.
|
||||||
* Represents interval [0, Long.MAX_VALUE) (allTime)
|
* Represents interval [0, Long.MAX_VALUE) (allTime)
|
||||||
|
* @deprecated This is made @InterfaceAudience.Private in the 2.0 line and above
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public TimeRange() {
|
public TimeRange() {
|
||||||
allTime = true;
|
allTime = true;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +53,9 @@ public class TimeRange {
|
||||||
/**
|
/**
|
||||||
* Represents interval [minStamp, Long.MAX_VALUE)
|
* Represents interval [minStamp, Long.MAX_VALUE)
|
||||||
* @param minStamp the minimum timestamp value, inclusive
|
* @param minStamp the minimum timestamp value, inclusive
|
||||||
|
* @deprecated This is made @InterfaceAudience.Private in the 2.0 line and above
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public TimeRange(long minStamp) {
|
public TimeRange(long minStamp) {
|
||||||
this.minStamp = minStamp;
|
this.minStamp = minStamp;
|
||||||
}
|
}
|
||||||
|
@ -59,7 +63,9 @@ public class TimeRange {
|
||||||
/**
|
/**
|
||||||
* Represents interval [minStamp, Long.MAX_VALUE)
|
* Represents interval [minStamp, Long.MAX_VALUE)
|
||||||
* @param minStamp the minimum timestamp value, inclusive
|
* @param minStamp the minimum timestamp value, inclusive
|
||||||
|
* @deprecated This is removed in the 2.0 line and above
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public TimeRange(byte [] minStamp) {
|
public TimeRange(byte [] minStamp) {
|
||||||
this.minStamp = Bytes.toLong(minStamp);
|
this.minStamp = Bytes.toLong(minStamp);
|
||||||
}
|
}
|
||||||
|
@ -68,15 +74,18 @@ public class TimeRange {
|
||||||
* Represents interval [minStamp, maxStamp)
|
* Represents interval [minStamp, maxStamp)
|
||||||
* @param minStamp the minimum timestamp, inclusive
|
* @param minStamp the minimum timestamp, inclusive
|
||||||
* @param maxStamp the maximum timestamp, exclusive
|
* @param maxStamp the maximum timestamp, exclusive
|
||||||
* @throws IllegalArgumentException
|
* @throws IllegalArgumentException if either <0,
|
||||||
|
* @throws IOException if max smaller than min.
|
||||||
|
* @deprecated This is made @InterfaceAudience.Private in the 2.0 line and above
|
||||||
*/
|
*/
|
||||||
public TimeRange(long minStamp, long maxStamp) {
|
@Deprecated
|
||||||
|
public TimeRange(long minStamp, long maxStamp) throws IOException {
|
||||||
if (minStamp < 0 || maxStamp < 0) {
|
if (minStamp < 0 || maxStamp < 0) {
|
||||||
throw new IllegalArgumentException("Timestamp cannot be negative. minStamp:" + minStamp
|
throw new IllegalArgumentException("Timestamp cannot be negative. minStamp:" + minStamp
|
||||||
+ ", maxStamp:" + maxStamp);
|
+ ", maxStamp:" + maxStamp);
|
||||||
}
|
}
|
||||||
if(maxStamp < minStamp) {
|
if(maxStamp < minStamp) {
|
||||||
throw new IllegalArgumentException("maxStamp is smaller than minStamp");
|
throw new IOException("maxStamp is smaller than minStamp");
|
||||||
}
|
}
|
||||||
this.minStamp = minStamp;
|
this.minStamp = minStamp;
|
||||||
this.maxStamp = maxStamp;
|
this.maxStamp = maxStamp;
|
||||||
|
@ -87,7 +96,9 @@ public class TimeRange {
|
||||||
* @param minStamp the minimum timestamp, inclusive
|
* @param minStamp the minimum timestamp, inclusive
|
||||||
* @param maxStamp the maximum timestamp, exclusive
|
* @param maxStamp the maximum timestamp, exclusive
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
|
* @deprecated This is removed in the 2.0 line and above
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public TimeRange(byte [] minStamp, byte [] maxStamp)
|
public TimeRange(byte [] minStamp, byte [] maxStamp)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
this(Bytes.toLong(minStamp), Bytes.toLong(maxStamp));
|
this(Bytes.toLong(minStamp), Bytes.toLong(maxStamp));
|
||||||
|
|
Loading…
Reference in New Issue