You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "Haohui Mai (JIRA)" <ji...@apache.org> on 2014/10/08 07:58:33 UTC

[jira] [Commented] (HDFS-7207) libhdfs3 should not expose exceptions in public API

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

Haohui Mai commented on HDFS-7207:
----------------------------------

A possible solution is to introduce a {{Status}} class that contains the information carried by Java exception. For example:

{code}
class Status {
public:
  boolean OK(); ...
  const char *message(); ...
};
{code}

For optimization the class can back its state with a single char array, mimicking what {{leveldb::Status}} does.

> libhdfs3 should not expose exceptions in public API
> ---------------------------------------------------
>
>                 Key: HDFS-7207
>                 URL: https://issues.apache.org/jira/browse/HDFS-7207
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Haohui Mai
>            Priority: Blocker
>
> There are three major disadvantages of exposing exceptions in the public API:
> * Exposing exceptions in public APIs forces the downstream users to be compiled with {{-fexceptions}}, which might be infeasible in many use cases.
> * It forces other bindings to properly handle all C++ exceptions, which might be infeasible especially when the binding is generated by tools like SWIG.
> * It forces the downstream users to properly handle all C++ exceptions, which can be cumbersome as in certain cases it will lead to undefined behavior (e.g., throwing an exception in a destructor is undefined.)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)