Hi all,

It occur to me that when I'm trying to parse any of the binary data
files I listed below,
using  <Message>.parseFrom(byte []). it said nullpointer exception.

To my best knowledge, I think when the raw bytes does not contain
required field, protobuf API should return invalidprotobufexception
when using .parseFrom(), or at least it will throw
uninitializeprotobuf exception when .build().
so that client will know what happen and have change to handle them
But if it return nullpointerexception, it will be hard to know what
really happen, it can only be roughly assumed message parsing is
My goal is just to determine if the received binary files is an
expected protobuf message or not.

Please kindly advise or if this is work as design under some reason.
Thanks a lot !

<code snippet>
       String filepath = "np1.pb";
       byte[] file_byteary = getBytesFromFile(new File(filepath));

       xxx.Connection.Builder conn_builder =
       xxx.Connection MB_tmp =
       System.out.println("is init?" + conn_builder.isInitialized());
       assertTrue(conn_builder.build() != null);
</code snippet>

* test data

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to