You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hbase.apache.org by st...@gmail.com, st...@gmail.com on 2019/03/18 20:33:15 UTC

IOException in Get.readVersions()

Hi,

The readVersions(int) method on Get (see https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html#readVersions-int-) throws an IOException if the argument is invalid:

  public Get readVersions(int versions) throws IOException {
    if (versions <= 0) {
      throw new IOException("versions must be positive");
    }
    this.maxVersions = versions;
    return this;
  }

I am wondering why this is 1) a checked exception and 2) why it is an IOException and not something like an IllegalArgumentException. Since I was not sure if this is intended or not and what the rational is, I thought I'd ask first.

Thanks,
Niko

Re: IOException in Get.readVersions()

Posted by Stack <st...@duboce.net>.
It should have been an IAE. As a community, we famously have an addition to
IOE [1].
S

1. https://blog.tsunanet.net/2012/04/apache-hadoop-abuse-ioexception.html

On Mon, Mar 18, 2019 at 3:07 PM strijbol.niko@gmail.com <
strijbol.niko@gmail.com> wrote:

> Hi,
>
> The readVersions(int) method on Get (see
> https://hbase.apache.org/apidocs/org/apache/hadoop/hbase/client/Get.html#readVersions-int-)
> throws an IOException if the argument is invalid:
>
>   public Get readVersions(int versions) throws IOException {
>     if (versions <= 0) {
>       throw new IOException("versions must be positive");
>     }
>     this.maxVersions = versions;
>     return this;
>   }
>
> I am wondering why this is 1) a checked exception and 2) why it is an
> IOException and not something like an IllegalArgumentException. Since I was
> not sure if this is intended or not and what the rational is, I thought I'd
> ask first.
>
> Thanks,
> Niko
>