Top Description Fields Constructors Methods
com.google.protobuf

public Class UninitializedMessageException

extends RuntimeException
Class Inheritance
Imports
java.util.Collections, .List

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.
Author
[email protected] Kenton Varda

Field Summary

Modifier and TypeField and Description
private final List<String>
private static final long

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
public InvalidProtocolBufferException
private static String
buildDescription(final List<String> missingFields)

Construct the description string for this exception.

public List<String>
getMissingFields()

Get a list of human-readable names of required fields missing from this message.

Field Detail

missingFieldsback to summary
private final List<String> missingFields
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.lang.RuntimeException.serialVersionUID.

Constructor Detail

UninitializedMessageExceptionback to summary
public UninitializedMessageException(final MessageLite message)
UninitializedMessageExceptionback to summary
public UninitializedMessageException(final List<String> missingFields)

Method Detail

asInvalidProtocolBufferExceptionback to summary
public InvalidProtocolBufferException asInvalidProtocolBufferException()

Converts this exception to an InvalidProtocolBufferException. When a parsed message is missing required fields, this should be thrown instead of UninitializedMessageException.

buildDescriptionback to summary
private static String buildDescription(final List<String> missingFields)

Construct the description string for this exception.

getMissingFieldsback to summary
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.