Index: src/java/org/apache/hadoop/hbase/client/HConnectionManager.java =================================================================== --- src/java/org/apache/hadoop/hbase/client/HConnectionManager.java (revision 932021) +++ src/java/org/apache/hadoop/hbase/client/HConnectionManager.java (working copy) @@ -1021,14 +1021,12 @@ LOG.debug("Found ROOT at " + rootRegionAddress); } break; - } catch (IOException e) { + } catch (Throwable t) { + t = translateException(t); + if (tries == numRetries - 1) { - // Don't bother sleeping. We've run out of retries. - if (e instanceof RemoteException) { - e = RemoteExceptionHandler.decodeRemoteException( - (RemoteException) e); - } - throw e; + throw new NoServerForRegionException("Timed out trying to locate "+ + "root region because: " + t.getMessage()); } // Sleep and retry finding root region. @@ -1068,15 +1066,7 @@ callable.instantiateServer(tries != 0); return callable.call(); } catch (Throwable t) { - if (t instanceof UndeclaredThrowableException) { - t = t.getCause(); - } - if (t instanceof RemoteException) { - t = RemoteExceptionHandler.decodeRemoteException((RemoteException)t); - } - if (t instanceof DoNotRetryIOException) { - throw (DoNotRetryIOException)t; - } + t = translateException(t); exceptions.add(t); if (tries == numRetries - 1) { throw new RetriesExhaustedException(callable.getServerName(), @@ -1098,15 +1088,7 @@ callable.instantiateServer(false); return callable.call(); } catch (Throwable t) { - if (t instanceof UndeclaredThrowableException) { - t = t.getCause(); - } - if (t instanceof RemoteException) { - t = RemoteExceptionHandler.decodeRemoteException((RemoteException) t); - } - if (t instanceof DoNotRetryIOException) { - throw (DoNotRetryIOException) t; - } + t = translateException(t); } return null; } @@ -1444,5 +1426,18 @@ } }; } + + private Throwable translateException(Throwable t) throws IOException { + if (t instanceof UndeclaredThrowableException) { + t = t.getCause(); + } + if (t instanceof RemoteException) { + t = RemoteExceptionHandler.decodeRemoteException((RemoteException)t); + } + if (t instanceof DoNotRetryIOException) { + throw (DoNotRetryIOException)t; + } + return t; + } } }