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

Matt Dailey commented on ACCUMULO-2493:
---------------------------------------

I started digging into this, and it looks more complicated than I hoped.  It 
seems the purpose of {{getlength}} (which probably was meant to be named 
setlength) is really to support the {{-f}} option in ScanCommand.  If that 
shell option is present, the code path [starting 
here|https://github.com/apache/accumulo/blob/2b6e68b6a6966c4dc80b422aa9e7a1766936b7da/shell/src/main/java/org/apache/accumulo/shell/commands/ScanCommand.java#L114]
 will set that static {{showLength}} value, and always use the BinaryFormatter 
rather than the set formatter (which could be considered a separate issue, too).

It seems {{getlength}} changes the static state to get around the fact that the 
static {{FormatterFactory.getFormatter}} does not have the ability to set the 
show length (used 
[here|https://github.com/apache/accumulo/blob/2b6e68b6a6966c4dc80b422aa9e7a1766936b7da/shell/src/main/java/org/apache/accumulo/shell/Shell.java#L1120]).

I don't see a quick and easy fix here; maybe a change needs to happen in 
FormatterFactory to support additional parameters to send to the Formatter?

> BinaryFormatter needs to be refactored
> --------------------------------------
>
>                 Key: ACCUMULO-2493
>                 URL: https://issues.apache.org/jira/browse/ACCUMULO-2493
>             Project: Accumulo
>          Issue Type: Bug
>          Components: client
>            Reporter: Mike Drob
>            Assignee: Steve Blackmore
>              Labels: newbie
>             Fix For: 1.7.1, 1.8.0
>
>
> BinaryFormatter is currently used in a couple places in the shell, but the 
> code is hard to read and understand. There is a static getlength, which is 
> actually a setter, and all the instance calls end up going through 
> unnecessary static methods.
> This combination makes it hard to reuse BinaryFormatter objects, or even use 
> multiple, since the static state is likely to conflict.



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

Reply via email to