Permalink
Browse files

be more conservative in handle_keeper_exception, raise if there's no …

…intValue

reported by bnagy on IRC
  • Loading branch information...
1 parent 1799f63 commit cb86bcde75563b63d8b37f3cd0d9cce669b18690 @slyphon slyphon committed Jul 1, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 java/java_base.rb
View
@@ -443,17 +443,22 @@ def resume_after_fork_in_parent
# this is a no-op in java-land
end
- protected
+ private
def jzk
@mutex.synchronize { @jzk }
end
def handle_keeper_exception
yield
rescue JZK::KeeperException => e
- e.cause.code.intValue
+ if e.respond_to?(:cause) and e.cause and e.cause.respond_to?(:code) and e.cause.code and e.cause.code.respond_to?(:intValue)
+ e.cause.code.intValue
+ else
+ raise e # dunno what happened, just raise it
+ end
end
+
def call_type(callback, watcher)
if callback
watcher ? :async_watch : :async
@@ -481,7 +486,6 @@ def get_default_global_watcher
}
end
- private
def replace_jzk!
orig_jzk = @jzk
@jzk = JZK::ZooKeeper.new(@host, DEFAULT_SESSION_TIMEOUT, JavaCB::WatcherCallback.new(event_queue, :client => self))

0 comments on commit cb86bcd

Please sign in to comment.