[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-209?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12645425#action_12645425
 ] 

Flavio Paiva Junqueira commented on ZOOKEEPER-209:
--------------------------------------------------

Whether you guys like it or not, this is the way we currently deal with some 
configuration errors. Check this piece of code from QuorumPeerConfig.parse():

{code:java}

File myIdFile = new File(dataDir, "myid");
                if (!myIdFile.exists()) {
                    LOG.error(myIdFile.toString() + " file is missing");
                    System.exit(2);
                }
                BufferedReader br = new BufferedReader(new 
FileReader(myIdFile));
                String myIdString;
                try {
                    myIdString = br.readLine();
                } finally {
                    br.close();
                }
                try {
                    conf.serverId = Long.parseLong(myIdString);
                } catch (NumberFormatException e) {
                    LOG.error(myIdString + " is not a number");
                    System.exit(2);
                }
            }
            instance=conf;
        } catch (Exception e) {
            LOG.error("FIXMSG",e);
            System.exit(2);
        }

{code}


My patch complies with the way we handle critical configuration errors 
currently. Now we all agree that we should have a better way of dealing with 
config errors, and for that I have created jira 217. We hence have two options:

# We apply this patch and exit before getting an npe, which again complies with 
the way we handle config errors currently. Later we fix more generally the 
problem of handling configuration errors with a patch for 217;
# We make this jira dependent on 217 and work on 217 directly, and we get an 
npe until then, which is btw fine with me because we currently output an error 
message pointing out the configuration problem.  



> nullpointerexception if election port is not specified.
> -------------------------------------------------------
>
>                 Key: ZOOKEEPER-209
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-209
>             Project: Zookeeper
>          Issue Type: Bug
>    Affects Versions: 3.0.0
>            Reporter: Mahadev konar
>            Assignee: Flavio Paiva Junqueira
>             Fix For: 3.0.1, 3.1.0
>
>         Attachments: ZOOKEEPER-209.patch
>
>
> The quoruom servers throw a nullpointer exception and still keep running. We 
> should atleast have a nice debug message and quit... 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to