srikanthtalasila / ez-vcard

Automatically exported from code.google.com/p/ez-vcard
0 stars 0 forks source link

Organization can remember only one value (with json parsing) #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Parse the following jCard  like this : 

String jcard = 
"[\"vcard\",[[\"version\",{},\"text\",\"4.0\"],[\"email\",{\"type\":\"home\"},\"
text\",\"perrine@perso1.fr\"],[\"org\",{},\"text\",[[\"Societe\",\"departement\"
,\"Bureau\"]]],[\"prodid\",{},\"text\",\"ez-vcard 0.9.6\"]]]";

VCard contactVCard = Ezvcard.parseJson(jcard).first();

2. Rewrite the jcard : 

System.out.println(contactVCard.writeJson());

3.

What is the expected output?
The same String as in entry, with all attributes for organization :

... [\"org\",{},\"text\",[[\"Societe\",\"departement\",\"Bureau\"]]] ...

What is the actual output?

["vcard",[["version",{},"text","4.0"],["email",{"type":"home"},"text","perrine@p
erso1.fr"],["org",{},"text","Societe"],["prodid",{},"text","ez-vcard 0.9.6"]]]

Only the first value for organization : 

... ["org",{},"text","Societe"] ...

What version of ez-vcard are you using?

What version of Java are you using?
0.9.6

Please provide any additional information below.
When I used the debugging tools, I saw that " 
contact.getOrganization().getValues() " contains only one value.

Original issue reported on code.google.com by glpc.gol...@gmail.com on 17 Apr 2015 at 3:49

GoogleCodeExporter commented 9 years ago
The ORG property is not correctly formatted in the input JSON string.  Its 
value is an array nested within an array--it should just be a regular array.

["org",{},"text",[["Societe","departement","Bureau"]]]

should be

["org",{},"text",["Societe","departement","Bureau"]]

Original comment by mike.angstadt on 21 Apr 2015 at 12:41

GoogleCodeExporter commented 9 years ago
Ok, in this case, the problem is with json writing, because this json example 
was an ezVCard output ;) 

Example : 
    public static void testOrganizationJsonWriting(){
        VCard vCard = new VCard();

        Organization organization = new Organization();
        organization.addValue("Society");
        organization.addValue("Department");
        organization.addValue("Office");
        vCard.addOrganization(organization);

        System.out.println(Ezvcard.writeJson(vCard).go());
    }

Give output : 

...,["org",{},"text",[["Society","Department","Office"]]],...

Original comment by glpc.gol...@gmail.com on 21 Apr 2015 at 8:28

GoogleCodeExporter commented 9 years ago
Ah, you are right!  Thanks for spotting this!

Fixed in this commit:
https://github.com/mangstadt/ez-vcard/commit/678cbff49430da4c57018dc722485775c5e
8a693

Original comment by mike.angstadt on 25 Apr 2015 at 1:06

GoogleCodeExporter commented 9 years ago
Thanks a lot ! :) 

Original comment by glpc.gol...@gmail.com on 29 Apr 2015 at 1:20