Exception UninitializedMessageException (3.19.4)
public class UninitializedMessageException extends RuntimeException
Thrown when attempting to build a protocol message that is missing required fields. This is a
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.
Constructors
UninitializedMessageException(MessageLite message)
public UninitializedMessageException(MessageLite message)
UninitializedMessageException(List<String> missingFields)
public UninitializedMessageException(List<String> missingFields)
Parameter |
Name |
Description |
missingFields |
List<String>
|
Methods
asInvalidProtocolBufferException()
public InvalidProtocolBufferException asInvalidProtocolBufferException()
Converts this exception to an InvalidProtocolBufferException. When a parsed message is
missing required fields, this should be thrown instead of
UninitializedMessageException
.
getMissingFields()
public List<String> getMissingFields()
Get a list of human-readable names of required fields missing from this message. Each name is a
full path to a field, e.g. "foo.bar[5].baz". Returns null if the lite runtime was used, since
it lacks the ability to find missing fields.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-10 UTC."],[],[]]