[
https://issues.apache.org/jira/browse/ACCUMULO-1970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13840570#comment-13840570
]
Sean Busbey commented on ACCUMULO-1970:
---------------------------------------
I'd really like to see the TableOperations.create method throw an appropriate
NamespaceNotFoundException when someone attempts to use a namespace that
doesn't exist. Making the NamespaceNotFoundException extend AccumuloException,
then having methods throw it is a good way to do that without causing an
incompatible API change for clients.
e.g. adding this to TableOperations.create will be compatible for old clients
(because they're already have code to deal with AccumuloException) while
allowing new clients to catch the specific subclass if they so desire.
If we want to make the Table related exceptions follow suite by changing them
to extend AccumuloException we'll need a deprecation cycle. The move will be
binary compatible but might cause problems i.e.
this will still behave as expected:
{code}
public boolean createTableIfNotExists(String table) {
boolean exists = true;
try {
connection.tableOperations().create(table);
} catch (TableExistsException exception) {
LOG.debug("table already existed.");
} catch (AccumuloException exception) {
exists = false;
LOG.error("unknown problem with accumulo.", exception);
}
return exists;
}
{code}
this will only end up running the code in the AccumuloException block:
{code}
public boolean createTableIfNotExists(String table) {
boolean exists = true;
try {
connection.tableOperations().create(table);
} catch (AccumuloException exception) {
exists = false;
LOG.error("unknown problem with accumulo.", exception);
} catch (TableExistsException exception) {
LOG.debug("table already existed.");
}
return exists;
}
{code}
The latter will cause a compiler error when the source is recompiled (which
will then prompt rearranging into the former), but without that a client would
silently get incorrect behavior.
> Namespaces need to create appropriate exceptions
> ------------------------------------------------
>
> Key: ACCUMULO-1970
> URL: https://issues.apache.org/jira/browse/ACCUMULO-1970
> Project: Accumulo
> Issue Type: Bug
> Components: client
> Reporter: John Vines
> Priority: Blocker
> Fix For: 1.6.0
>
>
> The ACCUMULO-820 patch left some very strange spaces in the client API around
> errors regarding namespaces. Dominantly, they are exceptions masked as
> generic AccumuloExceptions or NamespaceNotFoundExceptions wrapped in
> IllegalArgument and RuntimeExceptions. We need consistency and accuracy for
> these prior to putting out an API for them.
--
This message was sent by Atlassian JIRA
(v6.1#6144)