Author: mahadev
Date: Tue May  5 04:55:31 2009
New Revision: 771563

URL: http://svn.apache.org/viewvc?rev=771563&view=rev
Log:
ZOOKEEPER-384. keeper exceptions missing path (phunt via mahadev)

Modified:
    hadoop/zookeeper/trunk/CHANGES.txt
    hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
    
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java

Modified: hadoop/zookeeper/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/CHANGES.txt?rev=771563&r1=771562&r2=771563&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/CHANGES.txt (original)
+++ hadoop/zookeeper/trunk/CHANGES.txt Tue May  5 04:55:31 2009
@@ -111,6 +111,8 @@
 
   ZOOKEEPER-373. One thread per bookie (flavio via mahadev) 
 
+  ZOOKEEPER-384. keeper exceptions missing path (phunt via mahadev)
+
 NEW FEATURES:
 
   ZOOKEEPER-371. jdiff documentation included in build/release (giri via phunt)

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=771563&r1=771562&r2=771563&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java 
Tue May  5 04:55:31 2009
@@ -585,7 +585,8 @@
         request.setVersion(version);
         ReplyHeader r = cnxn.submitRequest(h, request, null, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()));
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
+                    path);
         }
     }
 
@@ -643,7 +644,8 @@
             if (r.getErr() == KeeperException.Code.NONODE.intValue()) {
                 return null;
             }
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()));
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
+                    path);
         }
 
         return response.getStat().getCzxid() == -1 ? null : response.getStat();
@@ -743,7 +745,8 @@
         }
         ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()));
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
+                    path);
         }
         if (stat != null) {
             DataTree.copyStat(response.getStat(), stat);
@@ -848,7 +851,8 @@
         SetDataResponse response = new SetDataResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()));
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
+                    path);
         }
         return response.getStat();
     }
@@ -901,7 +905,8 @@
         GetACLResponse response = new GetACLResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()));
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
+                    path);
         }
         DataTree.copyStat(response.getStat(), stat);
         return response.getAcl();
@@ -962,7 +967,8 @@
         SetACLResponse response = new SetACLResponse();
         ReplyHeader r = cnxn.submitRequest(h, request, response, null);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()));
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
+                    path);
         }
         return response.getStat();
     }
@@ -1026,7 +1032,8 @@
         }
         ReplyHeader r = cnxn.submitRequest(h, request, response, wcb);
         if (r.getErr() != 0) {
-            throw KeeperException.create(KeeperException.Code.get(r.getErr()));
+            throw KeeperException.create(KeeperException.Code.get(r.getErr()),
+                    path);
         }
         return response.getChildren();
     }

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java?rev=771563&r1=771562&r2=771563&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
 Tue May  5 04:55:31 2009
@@ -141,6 +141,7 @@
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/car", e.getPath());
         }
 
         try {
@@ -149,6 +150,7 @@
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo/car", e.getPath());
         }
 
         client.setData("/foo", "parent".getBytes(), -1);
@@ -177,12 +179,14 @@
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo", e.getPath());
         }
         try {
             lsnr.getData("/foo/bar", true, null);
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo/bar", e.getPath());
         }
 
         client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
@@ -216,12 +220,14 @@
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo", e.getPath());
         }
         try {
             lsnr.getChildren("/foo/bar", true);
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo/bar", e.getPath());
         }
 
         client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
@@ -341,12 +347,14 @@
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo", e.getPath());
         }
         try {
             lsnr.getData("/foo/bar", w2, null);
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo/bar", e.getPath());
         }
 
         client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);
@@ -407,12 +415,14 @@
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo", e.getPath());
         }
         try {
             lsnr.getChildren("/foo/bar", true);
             fail();
         } catch (KeeperException e) {
             assertEquals(KeeperException.Code.NONODE, e.code());
+            assertEquals("/foo/bar", e.getPath());
         }
 
         client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 
CreateMode.PERSISTENT);


Reply via email to