public class UninitializedMessageException
extends java.lang.RuntimeException
RuntimeException because it normally represents a programming error: it happens when some code which
constructs a message fails to set all the fields. parseFrom() methods do not throw this; they throw an
InvalidProtocolBufferException if required fields are missing, because it is not a programming error to
receive an incomplete message. In other words, UninitializedMessageException should never be thrown by
correct code, but InvalidProtocolBufferException might be.| Constructor and Description |
|---|
UninitializedMessageException(java.util.List<java.lang.String> missingFields) |
UninitializedMessageException(MessageLite message) |
| Modifier and Type | Method and Description |
|---|---|
InvalidProtocolBufferException |
asInvalidProtocolBufferException()
Converts this exception to an
InvalidProtocolBufferException. |
java.util.List<java.lang.String> |
getMissingFields()
Get a list of human-readable names of required fields missing from this message.
|
public UninitializedMessageException(MessageLite message)
public UninitializedMessageException(java.util.List<java.lang.String> missingFields)
@Nullable public java.util.List<java.lang.String> getMissingFields()
public InvalidProtocolBufferException asInvalidProtocolBufferException()
InvalidProtocolBufferException. When a parsed message is missing required
fields, this should be thrown instead of UninitializedMessageException.