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 correctly. But if it return nullpointerexception, it will be hard to know what really happen, it can only be roughly assumed message parsing is failed. 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.newBuilder(); xxx.Connection MB_tmp = xxx.Connection.parseFrom(file_byteary); conn_builder.mergeFrom(MB_tmp); System.out.println("is init?" + conn_builder.isInitialized()); assertTrue(conn_builder.build() != null); </code snippet> * test data https://docs.google.com/leaf?id=0B9CkCymjWlZLNWMyMGNiNjEtMDJiZi00NDY0LTgzMWUtMjI1N2I0MWVhNjlh&hl=en -- 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 protobuf+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/protobuf?hl=en.