From 047d209cee5285fb6b6d88d2ee45b3efb641b222 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Sun, 18 Mar 2012 19:40:24 +0000 Subject: [PATCH] HBASE-5955 Fix NoSuchMethodException in 0.92 when running on local filesystem git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1302207 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/regionserver/wal/HLog.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java b/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java index c245f060487..1c9202ad1ae 100644 --- a/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java +++ b/src/main/java/org/apache/hadoop/hbase/regionserver/wal/HLog.java @@ -454,26 +454,26 @@ public class HLog implements Syncable { */ private Method getGetNumCurrentReplicas(final FSDataOutputStream os) { Method m = null; - Exception exception = null; if (os != null) { + Class wrappedStreamClass = os.getWrappedStream() + .getClass(); try { - m = os.getWrappedStream().getClass(). - getDeclaredMethod("getNumCurrentReplicas", new Class []{}); + m = wrappedStreamClass.getDeclaredMethod("getNumCurrentReplicas", + new Class[] {}); m.setAccessible(true); } catch (NoSuchMethodException e) { - // Thrown if getNumCurrentReplicas() function isn't available - exception = e; + LOG.info("FileSystem's output stream doesn't support" + + " getNumCurrentReplicas; --HDFS-826 not available; fsOut=" + + wrappedStreamClass.getName()); } catch (SecurityException e) { - // Thrown if we can't get access to getNumCurrentReplicas() - exception = e; + LOG.info("Doesn't have access to getNumCurrentReplicas on " + + "FileSystems's output stream --HDFS-826 not available; fsOut=" + + wrappedStreamClass.getName(), e); m = null; // could happen on setAccessible() } } if (m != null) { LOG.info("Using getNumCurrentReplicas--HDFS-826"); - } else { - LOG.info("getNumCurrentReplicas--HDFS-826 not available; hdfs_out=" + - os, exception); } return m; }