You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "Josh Elser (JIRA)" <ji...@apache.org> on 2014/10/10 21:40:35 UTC

[jira] [Resolved] (ACCUMULO-3223) DefaultLoadBalancer allows a NPE just to catch it

     [ https://issues.apache.org/jira/browse/ACCUMULO-3223?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Josh Elser resolved ACCUMULO-3223.
----------------------------------
    Resolution: Fixed

> DefaultLoadBalancer allows a NPE just to catch it
> -------------------------------------------------
>
>                 Key: ACCUMULO-3223
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-3223
>             Project: Accumulo
>          Issue Type: Sub-task
>          Components: master
>    Affects Versions: 1.5.2, 1.6.1
>            Reporter: Josh Elser
>            Assignee: Josh Elser
>            Priority: Trivial
>             Fix For: 1.5.3, 1.6.2, 1.7.0
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> {{getOnlineTabletsForTable}} can return null for a couple of different reasons. The try/catch prevents the NPE from filtering up, but it is a confusing situation that can be re-written to be more clear. 
> {code:title=DefaultLoadBalancer.java}
>       Map<KeyExtent,TabletStats> onlineTabletsForTable = onlineTablets.get(table);
>       try {
>         if (onlineTabletsForTable == null) {
>           onlineTabletsForTable = new HashMap<KeyExtent,TabletStats>();
>           for (TabletStats stat : getOnlineTabletsForTable(tooMuch.server, table))
>             onlineTabletsForTable.put(new KeyExtent(stat.extent), stat);
>           onlineTablets.put(table, onlineTabletsForTable);
>         }
>       } catch (Exception ex) {
>         log.error("Unable to select a tablet to move", ex);
>         return result;
>       }
> {code}



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