GlowPod / protobuf-java-format

Automatically exported from code.google.com/p/protobuf-java-format
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

It just can not work for my test #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.Use JavaPropsFormat.printToString(myAddressBookProtoObj) to get a properties 
string
2.use this string to generate a proto object

What is the expected output? What do you see instead?
addressBookObject should be like this: 
addressbook:{
person {
  name: "jack"
  id: 1
  email: "jack@email.com"
  phone {
    number: "1234"
    type: HOME
  }
  phone {
    number: "5678"
    type: WORK
  }
}
}
However, there is an exception occured:
Exception in thread "main" java.lang.NullPointerException
    at com.google.protobuf.GeneratedMessage$FieldAccessorTable.access$100(Unknown Source)
    at com.google.protobuf.GeneratedMessage$Builder.newBuilderForField(Unknown Source)
    at com.googlecode.protobuf.format.JavaPropsFormat.mergeField(JavaPropsFormat.java:937)
    at com.googlecode.protobuf.format.JavaPropsFormat.merge(JavaPropsFormat.java:850)
    at com.googlecode.protobuf.format.JavaPropsFormat.merge(JavaPropsFormat.java:795)
    at com.example.tutorial.ProtoTest.print(ProtoTest.java:160)
    at com.example.tutorial.ProtoTest.main(ProtoTest.java:19)

What version of the product are you using? On what operating system?
1.2

Please provide any additional information below.
There is same issue for XmlFormat and JsonFormat.
It seems that JavaPropsFormat can printToString successfully and the properties 
string is as follows:
person[0].name="jack"
person[0].id=1
person[0].email="jack@email.com"
person[0].phone[0].number="1234"
person[0].phone[0].type=HOME
person[0].phone[1].number="5678"
person[0].phone[1].type=WORK

Original issue reported on code.google.com by xinzhou...@gmail.com on 28 Feb 2012 at 2:39