Repository: accumulo Updated Branches: refs/heads/1.6.0-SNAPSHOT b2008ca92 -> 18fa298e3 refs/heads/master c9f52faa7 -> 040da03b7
ACCUMULO-2660 handle invocation ex in dfslogger Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/18fa298e Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/18fa298e Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/18fa298e Branch: refs/heads/1.6.0-SNAPSHOT Commit: 18fa298e30907f12a47266886292904127b7838b Parents: b2008ca Author: Mike Drob <md...@cloudera.com> Authored: Fri Apr 11 11:37:41 2014 -0400 Committer: Mike Drob <md...@cloudera.com> Committed: Fri Apr 11 12:36:20 2014 -0400 ---------------------------------------------------------------------- .../apache/accumulo/tserver/log/DfsLogger.java | 22 +++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/18fa298e/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java ---------------------------------------------------------------------- diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java index 55df118..c960bd6 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/log/DfsLogger.java @@ -26,6 +26,7 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.nio.channels.ClosedChannelException; import java.util.ArrayList; @@ -456,9 +457,24 @@ public class DfsLogger { try { write(key, EMPTY); sync.invoke(logFile); - } catch (Exception ex) { - log.error(ex); - throw new IOException(ex); + } catch (IllegalArgumentException e) { + log.error("Signature of sync method changed. Accumulo is likely incompatible with this version of Hadoop."); + throw new RuntimeException(e); + } catch (IllegalAccessException e) { + log.error("Could not invoke sync method due to permission error."); + throw new RuntimeException(e); + } catch (InvocationTargetException e) { + Throwable cause = e.getCause(); + if (cause instanceof IOException) { + throw (IOException) cause; + } else if (cause instanceof RuntimeException) { + throw (RuntimeException) cause; + } else if (cause instanceof Error) { + throw (Error) cause; + } else { + // Cause is null, or some other checked exception that was added later. + throw new RuntimeException(e); + } } }