HBASE-2931 Do not throw RuntimeExceptions in RPC/HbaseObjectWritable code, ensure we log and rethrow as IOE

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@987952 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2010-08-22 22:20:16 +00:00
parent 461c835fc9
commit 88eb9c5281
2 changed files with 12 additions and 3 deletions

View File

@ -483,6 +483,9 @@ Release 0.21.0 - Unreleased
HBASE-2928 Fault in logic in BinaryPrefixComparator leads to HBASE-2928 Fault in logic in BinaryPrefixComparator leads to
ArrayIndexOutOfBoundsException (pranav via jgray) ArrayIndexOutOfBoundsException (pranav via jgray)
HBASE-2924 TestLogRolling doesn't use the right HLog half the time HBASE-2924 TestLogRolling doesn't use the right HLog half the time
HBASE-2931 Do not throw RuntimeExceptions in RPC/HbaseObjectWritable
code, ensure we log and rethrow as IOE
(Karthik Ranganathan via Stack)
IMPROVEMENTS IMPROVEMENTS
HBASE-1760 Cleanup TODOs in HTable HBASE-1760 Cleanup TODOs in HTable

View File

@ -159,7 +159,6 @@ public class HbaseObjectWritable implements Writable, Configurable {
addToMap(WritableByteArrayComparable.class, code++); addToMap(WritableByteArrayComparable.class, code++);
addToMap(FirstKeyOnlyFilter.class, code++); addToMap(FirstKeyOnlyFilter.class, code++);
addToMap(DependentColumnFilter.class, code++); addToMap(DependentColumnFilter.class, code++);
addToMap(ColumnPrefixFilter.class, code++);
addToMap(Delete [].class, code++); addToMap(Delete [].class, code++);
@ -172,6 +171,7 @@ public class HbaseObjectWritable implements Writable, Configurable {
// List // List
addToMap(List.class, code++); addToMap(List.class, code++);
addToMap(ColumnPrefixFilter.class, code++);
} }
private Class<?> declaredClass; private Class<?> declaredClass;
@ -450,13 +450,19 @@ public class HbaseObjectWritable implements Writable, Configurable {
try { try {
instanceClass = getClassByName(conf, className); instanceClass = getClassByName(conf, className);
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
throw new RuntimeException("Can't find class " + className); LOG.error("Can't find class " + className, e);
throw new IOException("Can't find class " + className, e);
} }
} else { } else {
instanceClass = CODE_TO_CLASS.get(b); instanceClass = CODE_TO_CLASS.get(b);
} }
Writable writable = WritableFactories.newInstance(instanceClass, conf); Writable writable = WritableFactories.newInstance(instanceClass, conf);
try {
writable.readFields(in); writable.readFields(in);
} catch (Exception e) {
LOG.error("Error in readFields", e);
throw new IOException("Error in readFields" , e);
}
instance = writable; instance = writable;
if (instanceClass == NullInstance.class) { // null if (instanceClass == NullInstance.class) { // null
declaredClass = ((NullInstance)instance).declaredClass; declaredClass = ((NullInstance)instance).declaredClass;