You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Chia-Ping Tsai (JIRA)" <ji...@apache.org> on 2018/02/14 13:13:01 UTC

[jira] [Commented] (HBASE-19985) Redundant instanceof check in ProtobufUtil#getServiceException

    [ https://issues.apache.org/jira/browse/HBASE-19985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16363966#comment-16363966 ] 

Chia-Ping Tsai commented on HBASE-19985:
----------------------------------------

The code in master is shown below.
{code:java}
public static IOException getServiceException(org.apache.hbase.thirdparty.com.google.protobuf.ServiceException e) {
  Throwable t = e.getCause();
  if (ExceptionUtil.isInterrupt(t)) {
    return ExceptionUtil.asInterrupt(t);
  }
  return t instanceof IOException ? (IOException) t : new HBaseIOException(t);
}{code}
ping [~lhofhansl]

> Redundant instanceof check in ProtobufUtil#getServiceException
> --------------------------------------------------------------
>
>                 Key: HBASE-19985
>                 URL: https://issues.apache.org/jira/browse/HBASE-19985
>             Project: HBase
>          Issue Type: Bug
>    Affects Versions: 1.4.1
>            Reporter: Ted Yu
>            Priority: Trivial
>             Fix For: 1.5.0, 1.4.2
>
>
> {code}
>   public static IOException getServiceException(ServiceException e) {
>     Throwable t = e;
>     if (e instanceof ServiceException) {
>       t = e.getCause();
> {code}
> The instanceof check would always return true.
> This was reported by https://builds.apache.org/job/PreCommit-HBASE-Build/11495/artifact/patchprocess/branch-findbugs-hbase-client-warnings.html#Warnings_STYLE



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)