You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Raul Gutierrez Segales (JIRA)" <ji...@apache.org> on 2014/07/21 19:44:39 UTC
[jira] [Commented] (ZOOKEEPER-1981) Fix Dodgy Code Warnings
[ https://issues.apache.org/jira/browse/ZOOKEEPER-1981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14068873#comment-14068873 ]
Raul Gutierrez Segales commented on ZOOKEEPER-1981:
---------------------------------------------------
Minor nit, instead of:
{noformat}
+ LOG.warn("unknown type " + m.type);
{noformat}
something like:
{noformat}
+ LOG.warn("ClassFoo#methodBar: unknown type " + m.type);
{noformat}
would give the operator more context when going through the logs.
> Fix Dodgy Code Warnings
> -----------------------
>
> Key: ZOOKEEPER-1981
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1981
> Project: ZooKeeper
> Issue Type: Sub-task
> Reporter: Hongchao Deng
> Assignee: Hongchao Deng
> Priority: Minor
> Fix For: 3.5.0
>
> Attachments: ZOOKEEPER-1981.patch
>
>
> There are two cases:
> 1. a duplicate check of null bytes.
> 2. a lot switch statement without default case.
> For the default case, I suggest
> 1. throwing an exception as a way to break the program. It's highly unexpected.
> 2. or LOG.warn it.
> I am doing the second right now to keep the original.
--
This message was sent by Atlassian JIRA
(v6.2#6252)