#9 NItemHandler too strict

closed
None
5
2008-11-19
2008-05-05
Ripper
No

When exporting contacts to vCard file, I have some contacts which I need to export without the firstname or the lastname specified. Current implementation does not allow me to do that and will not write the N tag at all (which is problem, because N tag is mandatory). There's no need to be as strict, I have not found any requirement in vCard specification which says that firstname (or lastname) must be specified.

Please change in net/wimpi/pim/contact/io/vcard/NItemHandler.java from this code:

//check validity (should at least have first and lastname)
if (pid == null
|| !StringUtil.isValidString(firstname)
|| !StringUtil.isValidString(lastname)) {

return new versitItem[0];
}

to this code:

//check validity (should at least have first and lastname)
if (pid == null
|| firstname == null
|| lastname == null) {

return new versitItem[0];
}

This will allow to explicitly specify firstname or lastname as "" and will create the N tag line.

Discussion

  • Ripper

    Ripper - 2008-05-05
    • summary: NItemHandler too sctrict --> NItemHandler too strict
     
  • Dieter Wimberger

    Logged In: YES
    user_id=36782
    Originator: NO

    Hello,

    If I remember correctly, the vCard Specification states (http://jpim.sourceforge.net/contacts/specifications/vcard-21.pdf, 2.2.2):
    "All vCard data streams should include this property to facilitate a common property for collating and sorting of vCard objects."

    Also note that the N property isn't necessarily a first and a lastname of a person, you may alternatetively use it for an object as well.

    This property is mandatory, and I don't think it makes any sense to attach it empty.

    Probably the export should fail or throw an exception, rather than quietly supress the output, though.

    Regards,
    Dieter

     
  • Dieter Wimberger

    • assigned_to: nobody --> wimpi
    • status: open --> closed-wont-fix
     
  • Ripper

    Ripper - 2008-05-05

    Logged In: YES
    user_id=1522033
    Originator: YES

    Well ok, it has no sense to have N empty, like this:
    N:;;;;

    But what if you need to specify person without knowing his given name (or you simply have the whole name in one string and don't know how to parse it)? It should be possible to create this tag:
    N:Smith;;;;
    (only family name, no given name). I don't see any problem with specification.

    You can't do it with jPim now.

     
  • Dieter Wimberger

    • status: closed-wont-fix --> pending
     
  • Dieter Wimberger

    Logged In: YES
    user_id=36782
    Originator: NO

    Maybe the code should check if at least one of the names or a prefix or a postfix is a valid string (non-empty, non null).

    This may not be the most elegant way, but whatever one uses to determine how the card should appear (N is what many clients use) will be in the N attribute.

    Regards,
    Dieter

     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).

     
  • SourceForge Robot

    • status: pending --> closed
     
  • Ripper

    Ripper - 2008-05-20
    • status: closed --> open
     
  • Ripper

    Ripper - 2008-05-20

    Logged In: YES
    user_id=1522033
    Originator: YES

    Well, there's nothing more I can comment on that. I agree with wimpi's proposal, it's good in my opinion. No automatic closing thence, sf-robot! :-)

     
  • Dieter Wimberger

    • status: open --> closed
     
  • Dieter Wimberger

    I have finally fixed this according to the discussion (some valid content will do for N) and will check it in with a bunch of changes and updates later.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks