com.google.protobuf.UninitializedMessageException Java Examples
The following examples show how to use
com.google.protobuf.UninitializedMessageException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtocolBufferParser.java From aliyun-tablestore-java-sdk with Apache License 2.0 | 5 votes |
@Override public Object getObject(ResponseMessage response) throws ResultParseException { Map<String, String> headers = response.getHeadersMap(); String requestId = headers.get(Constants.OTS_HEADER_REQUEST_ID); if (requestId == null){ throw new ClientException("The required header is missing: " + Constants.OTS_HEADER_REQUEST_ID); } try { Message result = message.newBuilderForType().mergeFrom(response.getContent()).buildPartial(); if (!result.isInitialized()) { throw new UninitializedMessageException( result).asInvalidProtocolBufferException(); } if (logger.isDebugEnabled()) { logger.debug("PBResponseMessage: {}, RequestId: {}, TraceId: {}", result.toString(), requestId, traceId); } return new ResponseContentWithMeta( result, new Response(requestId)); } catch(Exception e) { throw new ResultParseException("Failed to parse response as protocol buffer message.", e); } }