[protobuf] DynamicMessage and unknown fields

2014-06-12 Thread Sean Chen
Hi,

I have some code set up like this:
const Descriptor* msg_desc = pool-FindMessageTypeByName(class_name);
DynamicMessageFactory dmf;
Message* dm = dmf.GetPrototype(msg_desc)-New();
string str(serialized, length);
bool success = dm-ParseFromString(str);
...

which outputs the DebugString:
PowerRanger
1: Kimberly Ann Hart
2: Amy Jo Johnson
3: Pink

rather than
PowerRanger
CharacterName: Kimberly Ann Hart
ActressName: Amy Jo Johnson
Color: Pink

I've noticed that if I get the descriptor use the types provided by the 
compiled file, e.g. 
PowerRanger pr;
const Descriptor* msg_desc = pr.GetDescriptor();

The debug string will not have any unknown fields.  I've checked the pool, 
which has the file powerranger.proto, which leads me to believe that 
FindMessageTypeByName is losing info.  However,
the source says:
// These find descriptors by fully-qualified name.  These will find both
// top-level descriptors and nested descriptors.  They return NULL if not
// found.

Does anyone know why this is happening or how I can get the full 
DebugString() dynamically?

-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Re: DynamicMessage and unknown fields

2014-06-12 Thread Sean Chen
I forgot to add that I'm using Protobuf 2.4.0 for C++.

On Thursday, June 12, 2014 9:34:22 AM UTC-7, Sean Chen wrote:

 Hi,

 I have some code set up like this:
 const Descriptor* msg_desc = pool-FindMessageTypeByName(class_name);
 DynamicMessageFactory dmf;
 Message* dm = dmf.GetPrototype(msg_desc)-New();
 string str(serialized, length);
 bool success = dm-ParseFromString(str);
 ...

 which outputs the DebugString:
 PowerRanger
 1: Kimberly Ann Hart
 2: Amy Jo Johnson
 3: Pink

 rather than
 PowerRanger
 CharacterName: Kimberly Ann Hart
 ActressName: Amy Jo Johnson
 Color: Pink

 I've noticed that if I get the descriptor use the types provided by the 
 compiled file, e.g. 
 PowerRanger pr;
 const Descriptor* msg_desc = pr.GetDescriptor();

 The debug string will not have any unknown fields.  I've checked the pool, 
 which has the file powerranger.proto, which leads me to believe that 
 FindMessageTypeByName is losing info.  However,
 the source says:
 // These find descriptors by fully-qualified name.  These will find both
 // top-level descriptors and nested descriptors.  They return NULL if not
 // found.

 Does anyone know why this is happening or how I can get the full 
 DebugString() dynamically?


-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Re: DynamicMessage and unknown fields

2014-06-12 Thread Sean Chen
After a nice energizing lunch, I found out that I was parsing it into the 
wrong type...

On Thursday, June 12, 2014 10:46:50 AM UTC-7, Sean Chen wrote:

 I forgot to add that I'm using Protobuf 2.4.0 for C++.

 On Thursday, June 12, 2014 9:34:22 AM UTC-7, Sean Chen wrote:

 Hi,

 I have some code set up like this:
 const Descriptor* msg_desc = pool-FindMessageTypeByName(class_name);
 DynamicMessageFactory dmf;
 Message* dm = dmf.GetPrototype(msg_desc)-New();
 string str(serialized, length);
 bool success = dm-ParseFromString(str);
 ...

 which outputs the DebugString:
 PowerRanger
 1: Kimberly Ann Hart
 2: Amy Jo Johnson
 3: Pink

 rather than
 PowerRanger
 CharacterName: Kimberly Ann Hart
 ActressName: Amy Jo Johnson
 Color: Pink

 I've noticed that if I get the descriptor use the types provided by the 
 compiled file, e.g. 
 PowerRanger pr;
 const Descriptor* msg_desc = pr.GetDescriptor();

 The debug string will not have any unknown fields.  I've checked the 
 pool, which has the file powerranger.proto, which leads me to believe 
 that FindMessageTypeByName is losing info.  However,
 the source says:
 // These find descriptors by fully-qualified name.  These will find both
 // top-level descriptors and nested descriptors.  They return NULL if not
 // found.

 Does anyone know why this is happening or how I can get the full 
 DebugString() dynamically?



-- 
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Java MessageDifferencer

2024-02-21 Thread Sean Chen
In-line with this  issue in 
google/truth, does the protobuf-java take external submissions?

We have need for a Java based message differencer, and have done some work 
to clone the truth differencer into our local repository. Howerver it seems 
reasonably straightforward to do the work to add it directly to the 
protobuf-java library.

Is that something that would be considered or accepted?

Thanks for the info.

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/protobuf/3ec76a76-97ba-4c82-9815-1a7072ab8cb0n%40googlegroups.com.