Fix logic to decouple from the order of fields.keySet

pull/9047/head
Jason Lunn 4 years ago
parent 3581d85ced
commit a09c8e1c79
  1. 6
      ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java

@ -674,9 +674,9 @@ public class RubyMessage extends RubyObject {
boolean isDefaultStringForBytes = false;
FieldDescriptor enumFieldDescriptorForType =
this.builder.getDescriptorForType().findFieldByName("type");
EnumValueDescriptor type = enumFieldDescriptorForType == null ?
null : ((EnumValueDescriptor)this.builder.getField(enumFieldDescriptorForType));
if (type != null && type.getName().equals("TYPE_BYTES") &&
String type = enumFieldDescriptorForType == null ?
null : fields.get(enumFieldDescriptorForType).toString();
if (type != null && type.equals("TYPE_BYTES") &&
fieldDescriptor.getFullName().equals("google.protobuf.FieldDescriptorProto.default_value")) {
isDefaultStringForBytes = true;
}

Loading…
Cancel
Save