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

Aaron T. Myers commented on HDFS-3014:
--------------------------------------

It's  mostly personal preference. I just find this:

{code}
builder.append("AddOp [length=");
builder.append(length);
builder.append(", path=");
builder.append(path);
builder.append(", replication=");
builder.append(replication);
builder.append(", mtime=");
builder.append(mtime);
builder.append(", atime=");
builder.append(atime);
builder.append(", blockSize=");
builder.append(blockSize);
builder.append(", blocks=");
builder.append(Arrays.toString(blocks));
builder.append(", permissions=");
builder.append(permissions);
builder.append(", clientName=");
builder.append(clientName);
builder.append(", clientMachine=");
builder.append(clientMachine);
builder.append(", opCode=");
builder.append(opCode);
builder.append(", txid=");
builder.append(txid);
builder.append("]");
{code}

to be less readable than this:

{code}
String.format("AddOp [length=%d, path=%s, replication=%d, mtime=%d, atime=%d, 
blocksize=%d, " +
"blocks=%s, permissions=%s, clientName=%s, clientMachine=%s, opCode=%d, 
txid=%d]",
length, path, replication, mtime, atime, blockSize, Arrays.toString(blocks), 
permissions,
clientName, clientMachine, opCode, txid);
{code}

I also suspect that if one were to do a detailed analysis of StringBuilder vs. 
String.format usage in the code base, you'd probably find that StringBuilder is 
used mostly when there is an open-ended number of items to be included in the 
string (e.g. when stringifying a list of indeterminate length), and therefore 
String.format couldn't possibly be used.

Regardless, I don't feel very strongly about this point. If you think it's 
better to use StringBuilder, then I don't mind committing it as you've 
implemented it.

Thoughts?
                
> FSEditLogOp and its subclasses should have toString() method
> ------------------------------------------------------------
>
>                 Key: HDFS-3014
>                 URL: https://issues.apache.org/jira/browse/HDFS-3014
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>    Affects Versions: 0.23.0
>            Reporter: Sho Shimauchi
>            Assignee: Sho Shimauchi
>         Attachments: HDFS-3014.txt
>
>
> FSEditLogOp and its subclasses should have toString() method.
> It's helpful for investigating editlog related issues.
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to