result.setException(new RpcException(exception.getMessage()));
result.setException(new RpcException(exception.getMessage()));
@Test public void testSync_FileService_create_exception() throws Exception { final FileService.Client client = new FileService.Client.Factory().getClient(inProto, outProto); client.send_create(BAZ); assertThat(out.length()).isGreaterThan(0); final RuntimeException exception = Exceptions.clearTrace(new RuntimeException()); final THttpService service = THttpService.of((FileService.Iface) path -> { throw exception; }, defaultSerializationFormat); invoke(service); try { client.recv_create(); fail(TApplicationException.class.getSimpleName() + " not raised."); } catch (TApplicationException e) { assertThat(e.getType()).isEqualTo(TApplicationException.INTERNAL_ERROR); assertThat(e.getMessage()).contains(exception.toString()); } }
@Test public void testAsync_FileService_create_exception() throws Exception { final FileService.Client client = new FileService.Client.Factory().getClient(inProto, outProto); client.send_create(BAZ); assertThat(out.length()).isGreaterThan(0); final RuntimeException exception = Exceptions.clearTrace(new RuntimeException()); final THttpService service = THttpService.of( (FileService.AsyncIface) (path, resultHandler) -> resultHandler.onError(exception), defaultSerializationFormat); invoke(service); try { client.recv_create(); fail(TApplicationException.class.getSimpleName() + " not raised."); } catch (TApplicationException e) { assertThat(e.getType()).isEqualTo(TApplicationException.INTERNAL_ERROR); assertThat(e.getMessage()).contains(exception.toString()); } }
@Override public boolean listPartitionsByExpr(String catName, String db_name, String tbl_name, byte[] expr, String default_partition_name, int max_parts, List<Partition> result) throws TException { assert result != null; PartitionsByExprRequest req = new PartitionsByExprRequest( db_name, tbl_name, ByteBuffer.wrap(expr)); if (default_partition_name != null) { req.setDefaultPartitionName(default_partition_name); } if (max_parts >= 0) { req.setMaxParts(shrinkMaxtoShort(max_parts)); } PartitionsByExprResult r; try { r = client.get_partitions_by_expr(req); } catch (TApplicationException te) { // TODO: backward compat for Hive <= 0.12. Can be removed later. if (te.getType() != TApplicationException.UNKNOWN_METHOD && te.getType() != TApplicationException.WRONG_METHOD_NAME) { throw te; } throw new IncompatibleMetastoreException( "Metastore doesn't support listPartitionsByExpr: " + te.getMessage()); } r.setPartitions(FilterUtils.filterPartitionsIfEnabled(isClientFilterEnabled, filterHook, r.getPartitions())); // TODO: in these methods, do we really need to deepcopy? deepCopyPartitions(r.getPartitions(), result); return !r.isSetHasUnknownPartitions() || r.isHasUnknownPartitions(); // Assume the worst. }
public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(TAPPLICATION_EXCEPTION_STRUCT); if (getMessage() != null) { oprot.writeFieldBegin(MESSAGE_FIELD); oprot.writeString(getMessage()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TYPE_FIELD); oprot.writeI32(type_); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } }
"Metastore doesn't support listPartitionsByExpr: " + te.getMessage());
throw new AccumuloSecurityException(e.user, e.code, e); } catch (TApplicationException e) { log.debug("Server : {} msg : {}", server, e.getMessage(), e); throw new AccumuloServerException(server, e); } catch (NoSuchScanIDException e) {
public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(TAPPLICATION_EXCEPTION_STRUCT); if (getMessage() != null) { oprot.writeFieldBegin(MESSAGE_FIELD); oprot.writeString(getMessage()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TYPE_FIELD); oprot.writeI32(type_); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } }
public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(TAPPLICATION_EXCEPTION_STRUCT); if (getMessage() != null) { oprot.writeFieldBegin(MESSAGE_FIELD); oprot.writeString(getMessage()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TYPE_FIELD); oprot.writeI32(type_); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } }
public void write(TProtocol oprot) throws TException { oprot.writeStructBegin(TAPPLICATION_EXCEPTION_STRUCT); if (getMessage() != null) { oprot.writeFieldBegin(MESSAGE_FIELD); oprot.writeString(getMessage()); oprot.writeFieldEnd(); } oprot.writeFieldBegin(TYPE_FIELD); oprot.writeI32(type_); oprot.writeFieldEnd(); oprot.writeFieldStop(); oprot.writeStructEnd(); } }
private static Exception toDriftException(Exception e) { if (e instanceof org.apache.thrift.TApplicationException) { org.apache.thrift.TApplicationException tae = (org.apache.thrift.TApplicationException) e; return new TApplicationException(tae.getType(), tae.getMessage()); } if (e instanceof org.apache.thrift.transport.TTransportException) { return new TTransportException(e); } if (e instanceof org.apache.thrift.protocol.TProtocolException) { return new TProtocolException(e); } if (e instanceof org.apache.thrift.TException) { return new TException(e); } return e; } }
private static Exception toDriftException(Exception e) { if (e instanceof org.apache.thrift.TApplicationException) { org.apache.thrift.TApplicationException tae = (org.apache.thrift.TApplicationException) e; return new TApplicationException(tae.getType(), tae.getMessage()); } if (e instanceof org.apache.thrift.transport.TTransportException) { return new TTransportException(e); } if (e instanceof org.apache.thrift.protocol.TProtocolException) { return new TProtocolException(e); } if (e instanceof org.apache.thrift.TException) { return new TException(e); } return e; } }
throw new AccumuloSecurityException(e.user, e.code, e); } catch (TApplicationException e) { log.debug("Server : {} msg : {}", server, e.getMessage(), e); throw new AccumuloServerException(server, e); } catch (NoSuchScanIDException e) {
result.setException(new RpcException(exception.getMessage()));
result.setException(new RpcException(exception.getMessage()));
result.setException(new RpcException(exception.getMessage()));
} else if (message.type == TMessageType.EXCEPTION) { TApplicationException exception = TApplicationException.read(protocol); MetaUtil.wrapException(exception.getMessage(), response);
@Override public boolean listPartitionsByExpr(String db_name, String tbl_name, byte[] expr, String default_partition_name, short max_parts, List<Partition> result) throws TException { assert result != null; PartitionsByExprRequest req = new PartitionsByExprRequest( db_name, tbl_name, ByteBuffer.wrap(expr)); if (default_partition_name != null) { req.setDefaultPartitionName(default_partition_name); } if (max_parts >= 0) { req.setMaxParts(max_parts); } PartitionsByExprResult r = null; try { r = client.get_partitions_by_expr(req); } catch (TApplicationException te) { // TODO: backward compat for Hive <= 0.12. Can be removed later. if (te.getType() != TApplicationException.UNKNOWN_METHOD && te.getType() != TApplicationException.WRONG_METHOD_NAME) { throw te; } throw new IncompatibleMetastoreException( "Metastore doesn't support listPartitionsByExpr: " + te.getMessage()); } r.setPartitions(filterHook.filterPartitions(r.getPartitions())); // TODO: in these methods, do we really need to deepcopy? deepCopyPartitions(r.getPartitions(), result); return !r.isSetHasUnknownPartitions() || r.isHasUnknownPartitions(); // Assume the worst. }
@Override public boolean listPartitionsByExpr(String db_name, String tbl_name, byte[] expr, String default_partition_name, short max_parts, List<Partition> result) throws TException { assert result != null; PartitionsByExprRequest req = new PartitionsByExprRequest( db_name, tbl_name, ByteBuffer.wrap(expr)); if (default_partition_name != null) { req.setDefaultPartitionName(default_partition_name); } if (max_parts >= 0) { req.setMaxParts(max_parts); } PartitionsByExprResult r = null; try { r = client.get_partitions_by_expr(req); } catch (TApplicationException te) { // TODO: backward compat for Hive <= 0.12. Can be removed later. if (te.getType() != TApplicationException.UNKNOWN_METHOD && te.getType() != TApplicationException.WRONG_METHOD_NAME) { throw te; } throw new IncompatibleMetastoreException( "Metastore doesn't support listPartitionsByExpr: " + te.getMessage()); } r.setPartitions(filterHook.filterPartitions(r.getPartitions())); // TODO: in these methods, do we really need to deepcopy? deepCopyPartitions(r.getPartitions(), result); return !r.isSetHasUnknownPartitions() || r.isHasUnknownPartitions(); // Assume the worst. }