Menu

ATTENDEE - Bad format

2013-07-19
2013-07-22
  • Caruyer Perrine

    Caruyer Perrine - 2013-07-19

    Hello,
    I'm doing some tests with 'ATTENDEE' like this :

    1) in the ics file :
    ATTENDEE;ROLE=3DREQ-PARTICIPANT;RSVP=3DTRUE:MAILTO:aaa@domain.com

    2) what I asked for in Java :
    System.out.println("ATTENDEE rsvp: "+ical.getEvents().get(0).getAttendees().get(0).getRsvp());
    System.out.println("ATTENDEE mailto: "+ical.getEvents().get(0).getAttendees().get(0).getParameter("MAILTO"));
    System.out.println("ATTENDEE role: "+ical.getEvents().get(0).getAttendees().get(0).getRole());

    3) what I get in the console :
    ATTENDEE rsvp: false
    ATTENDEE mailto: null
    Exception in thread "main" java.lang.RuntimeException: java.lang.NoSuchMethodException: biweekly.parameter.Role.<init>(java.lang.String)
    at biweekly.parameter.ICalParameterCaseClasses.create(ICalParameterCaseClasses.java:51)
    at biweekly.parameter.ICalParameterCaseClasses.create(ICalParameterCaseClasses.java:38)
    at biweekly.util.CaseClasses.find(CaseClasses.java:127)
    at biweekly.util.CaseClasses.get(CaseClasses.java:97)
    at biweekly.parameter.Role.get(Role.java:66)
    at biweekly.parameter.ICalParameters.getRole(ICalParameters.java:479)
    at biweekly.property.Attendee.getRole(Attendee.java:129)
    at Tests.TestBiWeeklyParsing.parse(TestBiWeeklyParsing.java:118)
    at Tests.TestBiWeeklyParsing.main(TestBiWeeklyParsing.java:52)
    Caused by: java.lang.NoSuchMethodException: biweekly.parameter.Role.<init>(java.lang.String)
    at java.lang.Class.getConstructor0(Class.java:2706)
    at java.lang.Class.getConstructor(Class.java:1657)
    at biweekly.parameter.ICalParameterCaseClasses.create(ICalParameterCaseClasses.java:47)
    ... 8 more

    4) my questions :D
    - RSVP is not well formated because of "3D" before "true". It returns false. Is it possible to return true ? To have a warning ??
    - MAILTO : I didn't find how to get it ?
    - ROLE is not well formated because of "3D" before "REQ-PARTICIPANT". Is it possible to return "REQ-PARTICIPANT" ? To have a warning ? At least, avoid the Exception ?

    Thanks a lot,
    Perrine

     

    Last edit: Caruyer Perrine 2013-07-22
  • Michael Angstadt

    To answer your questions:

    RSVP parameter

    All parameter values in biweekly are stored internally as Strings. When you call getRsvp(), it gets the string value of the parameter, then converts it to a Boolean object using the Boolean.valueOf() method. So, it's returning false because this is what Boolean.valueOf() returns when it encounters something other than "true" or "false".

    As a work-around, you can get the raw String value like so:

    ical.getEvents().get(0).getAttendees().get(0).getParameter("RSVP");
    //returns: "3DTRUE"
    

    I probably should have it log a warning though. I'll see if I can add this.

    MAILTO parameter

    This is actually not a parameter at all. It's part of the property value. The value of the ATTENDEE property typically is an email URI, which takes the form of "mailto:email@address.com"

    To get the value of the ATTENDEE property:

    ical.getEvents().get(0).getAttendees().get(0).getValue();
    //returns: "MAILTO:aaa@domain.com"
    

    ROLE parameter

    The exception you are getting is a bug, which has been fixed. The fix will be included in the next release. Once the next version has been released, your existing code will work without throwing the exception.

    As a work-around, you can get the raw String value of the parameter like so:

    ical.getEvents().get(0).getAttendees().get(0).getParameter("ROLE");
    //returns: "3DREQ-PARTICIPANT"
    

    Thanks,
    Mike

     

    Last edit: Michael Angstadt 2013-07-22
  • Michael Angstadt

    I finished adding parameter value validation (see Ticket 2). Parameters like RSVP will be checked when you call the validate() method on the ICalendar object.

    I thought it would be better to check them there instead of during the parse operation because these problems have more do to with the correctness of the iCalendar data model, as opposed to the correctness of whatever syntax is used to send the data over the wire.

    Thanks,
    Mike

     
  • Caruyer Perrine

    Caruyer Perrine - 2013-07-22

    Thanks for you answer and your fixed.
    I'm sorry if I don't always understand RFC, I'm a beginner with iCals formats :)

    I didn't care when I posted my first message, I should have write an other adress. Could you replace the email adress in your post with "aaa@domain.com" please ?

    Thanks a lot.

     
  • Michael Angstadt

    Sure, fixed.

     

Anonymous
Anonymous

Add attachments
Cancel