[protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Aditya Narayan
I tried following code for encoding and decoding.

Decoding from byte[] fails, however.

Code:-

public static void test(){

Comment comment = Comment.newBuilder()
.setCommentBody(This is 1st comment)
.build();
byte[] bytes = comment.toByteArray();

try {
Comment c = Comment.parseFrom(bytes);
}
catch (InvalidProtocolBufferException ex) {
Logger.getLogger(testing.class.getName()).log(Level.SEVERE, 
null, ex);
}

Exception details:-

Exception in thread main java.lang.RuntimeException: Uncompilable 
source code
at 
com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java)
at 
com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:153)
at 
com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:709)
at 
paratha.serializers.protocolbuffers.CommentProto$Comment.parseFrom(CommentProto.java:186)




-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@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.



[protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Aditya Narayan
I tried following code for encoding and decoding.

Decoding from byte[] fails, however.

Code:-

public static void test(){

Comment comment = Comment.newBuilder()
.setCommentBody(This is 1st comment)
.build();
byte[] bytes = comment.toByteArray();

try {
Comment c = Comment.parseFrom(bytes);
}
catch (InvalidProtocolBufferException ex) {
Logger.getLogger(testing.class.getName()).log(Level.SEVERE, 
null, ex);
}

Exception details:-

Exception in thread main java.lang.RuntimeException: Uncompilable 
source code
at 
com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java)
at 
com.google.protobuf.AbstractMessageLite$Builder.mergeFrom(AbstractMessageLite.java:153)
at 
com.google.protobuf.AbstractMessage$Builder.mergeFrom(AbstractMessage.java:709)
at 
paratha.serializers.protocolbuffers.CommentProto$Comment.parseFrom(CommentProto.java:186)




-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@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.



Re: [protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Evan Jones

On Mar 4, 2011, at 11:11 , Aditya Narayan wrote:
Exception in thread main java.lang.RuntimeException:  
Uncompilable source code


This error means there is a build problem in your Eclipse project. You  
are trying to call some code that is not building compiled correctly.  
Fix your build errors and then your example should work. Good luck,


Evan

--
http://evanjones.ca/

--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to protobuf@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.



Re: [protobuf] RuntimeException while parsing back the byte[] to protocol buffer message instance! (deserialization)

2011-03-04 Thread Aditya Narayan
Thanks Evan

Seems like I am missing some files. I have just created a .proto file and 
compiled it with protoc to get generated java files. I got  .java file 
compiled and put it with the java's source folder from protobuf 2.4.a in my 
project folder.

But some of the class dependency of the files in this folder seem to be 
unresolved. I think I would instead need a jar that I could add to classpath 
of my project.

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@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.