HBASE-13419 Thrift gateway should propagate text from exception causes (Michael Muller)

This commit is contained in:
tedyu 2015-04-13 09:58:04 -07:00
parent e75c6201c6
commit 679e0e8d2e
1 changed files with 38 additions and 37 deletions

View File

@ -130,6 +130,7 @@ import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.thread.QueuedThreadPool;
import com.google.common.base.Joiner;
import com.google.common.base.Throwables;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
/**
@ -755,7 +756,7 @@ public class ThriftServerRunner implements Runnable {
getAdmin().enableTable(getTableName(tableName));
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -765,7 +766,7 @@ public class ThriftServerRunner implements Runnable {
getAdmin().disableTable(getTableName(tableName));
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -775,7 +776,7 @@ public class ThriftServerRunner implements Runnable {
return this.connectionCache.getAdmin().isTableEnabled(getTableName(tableName));
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -788,7 +789,7 @@ public class ThriftServerRunner implements Runnable {
((HBaseAdmin) getAdmin()).compact(getBytes(tableNameOrRegionName));
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -801,7 +802,7 @@ public class ThriftServerRunner implements Runnable {
((HBaseAdmin) getAdmin()).majorCompact(getBytes(tableNameOrRegionName));
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -816,7 +817,7 @@ public class ThriftServerRunner implements Runnable {
return list;
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -849,7 +850,7 @@ public class ThriftServerRunner implements Runnable {
return Collections.emptyList();
} catch (IOException e){
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -894,7 +895,7 @@ public class ThriftServerRunner implements Runnable {
return ThriftUtilities.cellFromHBase(result.rawCells());
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -937,7 +938,7 @@ public class ThriftServerRunner implements Runnable {
return ThriftUtilities.cellFromHBase(result.rawCells());
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -981,7 +982,7 @@ public class ThriftServerRunner implements Runnable {
return ThriftUtilities.cellFromHBase(result.rawCells());
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1038,7 +1039,7 @@ public class ThriftServerRunner implements Runnable {
return ThriftUtilities.rowResultFromHBase(result);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1103,7 +1104,7 @@ public class ThriftServerRunner implements Runnable {
return ThriftUtilities.rowResultFromHBase(result);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1135,7 +1136,7 @@ public class ThriftServerRunner implements Runnable {
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1157,7 +1158,7 @@ public class ThriftServerRunner implements Runnable {
table.delete(delete);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1178,10 +1179,10 @@ public class ThriftServerRunner implements Runnable {
getAdmin().createTable(desc);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
} catch (IllegalArgumentException e) {
LOG.warn(e.getMessage(), e);
throw new IllegalArgument(e.getMessage());
throw new IllegalArgument(Throwables.getStackTraceAsString(e));
}
}
@ -1202,7 +1203,7 @@ public class ThriftServerRunner implements Runnable {
getAdmin().deleteTable(tableName);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1260,10 +1261,10 @@ public class ThriftServerRunner implements Runnable {
table.put(put);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
} catch (IllegalArgumentException e) {
LOG.warn(e.getMessage(), e);
throw new IllegalArgument(e.getMessage());
throw new IllegalArgument(Throwables.getStackTraceAsString(e));
}
}
@ -1331,10 +1332,10 @@ public class ThriftServerRunner implements Runnable {
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
} catch (IllegalArgumentException e) {
LOG.warn(e.getMessage(), e);
throw new IllegalArgument(e.getMessage());
throw new IllegalArgument(Throwables.getStackTraceAsString(e));
}
}
@ -1360,7 +1361,7 @@ public class ThriftServerRunner implements Runnable {
getBytes(row), family, qualifier, amount);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1396,7 +1397,7 @@ public class ThriftServerRunner implements Runnable {
}
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
return ThriftUtilities.rowResultFromHBase(results, resultScannerWrapper.isColumnSorted());
}
@ -1450,7 +1451,7 @@ public class ThriftServerRunner implements Runnable {
return addScanner(table.getScanner(scan), tScan.sortColumns);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1475,7 +1476,7 @@ public class ThriftServerRunner implements Runnable {
return addScanner(table.getScanner(scan), false);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1501,7 +1502,7 @@ public class ThriftServerRunner implements Runnable {
return addScanner(table.getScanner(scan), false);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1531,7 +1532,7 @@ public class ThriftServerRunner implements Runnable {
return addScanner(table.getScanner(scan), false);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1557,7 +1558,7 @@ public class ThriftServerRunner implements Runnable {
return addScanner(table.getScanner(scan), false);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1585,7 +1586,7 @@ public class ThriftServerRunner implements Runnable {
return addScanner(table.getScanner(scan), false);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1606,7 +1607,7 @@ public class ThriftServerRunner implements Runnable {
return columns;
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1619,7 +1620,7 @@ public class ThriftServerRunner implements Runnable {
return ThriftUtilities.cellFromHBase(result.rawCells());
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1658,7 +1659,7 @@ public class ThriftServerRunner implements Runnable {
return region;
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1696,7 +1697,7 @@ public class ThriftServerRunner implements Runnable {
table.increment(inc);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1724,7 +1725,7 @@ public class ThriftServerRunner implements Runnable {
return ThriftUtilities.cellFromHBase(result.rawCells());
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
}
}
@ -1745,7 +1746,7 @@ public class ThriftServerRunner implements Runnable {
put.setDurability(mput.writeToWAL ? Durability.SYNC_WAL : Durability.SKIP_WAL);
} catch (IllegalArgumentException e) {
LOG.warn(e.getMessage(), e);
throw new IllegalArgument(e.getMessage());
throw new IllegalArgument(Throwables.getStackTraceAsString(e));
}
Table table = null;
@ -1756,10 +1757,10 @@ public class ThriftServerRunner implements Runnable {
value != null ? getBytes(value) : HConstants.EMPTY_BYTE_ARRAY, put);
} catch (IOException e) {
LOG.warn(e.getMessage(), e);
throw new IOError(e.getMessage());
throw new IOError(Throwables.getStackTraceAsString(e));
} catch (IllegalArgumentException e) {
LOG.warn(e.getMessage(), e);
throw new IllegalArgument(e.getMessage());
throw new IllegalArgument(Throwables.getStackTraceAsString(e));
}
}
}