Re: [PATCH] javaclient: validate sessionTimeout field at ZooKeeper init (JIRA ZOOKEEPER-776)

2010-05-21 Thread Henry Robinson
Hi Greg -

Thanks very much for contributing! We've got some guidelines here:
http://wiki.apache.org/hadoop/ZooKeeper/HowToContribute - let me know if
they're not clear.

The main thing for you to do is to attach your patch to the JIRA and click
the 'Licensed for inclusion into Apache projects' button when you do. You
can do this by clicking 'Attach patch' on the JIRA itself. Once you've done
that, please click 'Submit patch' to kick off our automated QA procedures.

Assuming all goes well, a committer will pick up the baton from there and
get the patch into trunk (or let you know if they think changes are
necessary).

Thanks!

Henry

On 21 May 2010 12:22, Gregory Haskins  wrote:

> Hi All,
>
> First patch submission for me.  If there are any patch submission
> guidelines I should follow, kindly point me at them and accept my
> apology if this approach violates any established procedures.  I didn't
> find anything obvious on the site wiki, so I just used some practices
> learned on other projects.
>
> -Greg
>
> 
>
> commit 840f56d388582e1df39f7513aa7f4d4ce0610718
> Author: Gregory Haskins 
> Date:   Fri May 21 14:58:14 2010 -0400
>
>javaclient: validate sessionTimeout field at ZooKeeper init
>
>JIRA ZOOKEEPER-776 describes the following problem:
>
>passing in a "0" sessionTimeout to ZooKeeper() constructor leads to
> errors
>in subsequent operations. It would be ideal to capture this
> configuration
>error at the source by throwing something like an IllegalArgument
> exception
>when the bogus sessionTimeout is specified, instead of later when it is
>utilized.
>
>This patch is a proposal to fix the problem referenced above.
>
>Applies to svn-id: 946074
>
>Signed-off-by: Gregory Haskins 
>
> diff --git a/src/java/main/org/apache/zookeeper/ClientCnxn.java
> b/src/java/main/
> index 8eb227d..682811b 100644
> --- a/src/java/main/org/apache/zookeeper/ClientCnxn.java
> +++ b/src/java/main/org/apache/zookeeper/ClientCnxn.java
> @@ -353,6 +353,11 @@ public class ClientCnxn {
> this.sessionId = sessionId;
> this.sessionPasswd = sessionPasswd;
>
> +   if (sessionTimeout <= 0) {
> +   throw new IOException("sessionTimeout " + sessionTimeout
> + + " is not valid");
> +   }
> +
> // parse out chroot, if any
> int off = hosts.indexOf('/');
> if (off >= 0) {
>
>


-- 
Henry Robinson
Software Engineer
Cloudera
415-994-6679


[PATCH] javaclient: validate sessionTimeout field at ZooKeeper init (JIRA ZOOKEEPER-776)

2010-05-21 Thread Gregory Haskins
Hi All,

First patch submission for me.  If there are any patch submission
guidelines I should follow, kindly point me at them and accept my
apology if this approach violates any established procedures.  I didn't
find anything obvious on the site wiki, so I just used some practices
learned on other projects.

-Greg



commit 840f56d388582e1df39f7513aa7f4d4ce0610718
Author: Gregory Haskins 
Date:   Fri May 21 14:58:14 2010 -0400

javaclient: validate sessionTimeout field at ZooKeeper init
   
JIRA ZOOKEEPER-776 describes the following problem:

passing in a "0" sessionTimeout to ZooKeeper() constructor leads to
errors
in subsequent operations. It would be ideal to capture this
configuration
error at the source by throwing something like an IllegalArgument
exception
when the bogus sessionTimeout is specified, instead of later when it is
utilized.

This patch is a proposal to fix the problem referenced above.

Applies to svn-id: 946074

Signed-off-by: Gregory Haskins 

diff --git a/src/java/main/org/apache/zookeeper/ClientCnxn.java
b/src/java/main/
index 8eb227d..682811b 100644
--- a/src/java/main/org/apache/zookeeper/ClientCnxn.java
+++ b/src/java/main/org/apache/zookeeper/ClientCnxn.java
@@ -353,6 +353,11 @@ public class ClientCnxn {
 this.sessionId = sessionId;
 this.sessionPasswd = sessionPasswd;
 
+   if (sessionTimeout <= 0) {
+   throw new IOException("sessionTimeout " + sessionTimeout
+ + " is not valid");
+   }
+
 // parse out chroot, if any
 int off = hosts.indexOf('/');
 if (off >= 0) {



signature.asc
Description: OpenPGP digital signature