Hi,
I have the following message, under Protobuf 2.0.3:
message Message {
required string name = 1;
optional string nonce = 2;
}
When I call toString() on this message it throws a NullPointerException:
Exception in thread "main" java.lang.NullPointerException
at com.google.protobuf.ByteString.copyFromUtf8(Unknown Source)
at com.google.protobuf.TextFormat.escapeText(Unknown Source)
at com.google.protobuf.TextFormat.printFieldValue(Unknown Source)
at com.google.protobuf.TextFormat.printSingleField(Unknown Source)
at com.google.protobuf.TextFormat.printField(Unknown Source)
at com.google.protobuf.TextFormat.print(Unknown Source)
at com.google.protobuf.TextFormat.print(Unknown Source)
at com.google.protobuf.TextFormat.printToString(Unknown Source)
at com.google.protobuf.AbstractMessage.toString(Unknown Source)
Which means it is impossible to have a null default value in a message,
we have to always have a default value (which is sometimes not
possible).
Is that the expected behaviour?
/me adding defaults everywhere :-)
Thanks,
--
Brice Figureau
My Blog: http://www.masterzen.fr/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---