Bug when reporting events

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug when reporting events

Robin Léos-3

Hey Brad !

How are you doing ? I'm Robin, i'm working with Charles Chahbazian at Alinto ! ( We already spoke about dav few months ago ) 

It seems i just saw  something odd in the CalendarQueryReport class. Let me explain. I tried to figure why our app always synchronize all the events, even if i said to my ipad to only get the last 6 months. So i isolated this with Wireshark :

<?xml version="1.0" encoding="utf-8" ?>
<d:multistatus xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav"><d:response><d:href>/dav/cmallatrait%40alinto.int/calendar/default/</d:href><d:propstat><d:prop><cs:getctag/><d:sync-token/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>REPORT /dav/cmallatrait%40alinto.int/calendar/default/ HTTP/1.1
Host: 192.168.0.174:8080
User-Agent: iOS/7.0.4 (11B554a) dataaccessd/1.0
Accept-Language: fr-fr
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return-minimal
Depth: 1
Connection: keep-alive
Cookie: miltonUserUrl=b64L2Rhdi9jbWFsbGF0cmFpdEBhbGludG8uaW50L3ByaW5jaXBhbA%3D%3D; miltonUserUrlHash="24e0fbc7-d2df-46dc-adb7-03cee261710b:OLxicSGr7Eho-Vk-90HWgqDKi5Y"
Content-Length: 390
Brief: t
 
<?xml version="1.0" encoding="UTF-8"?>
<B:calendar-query xmlns:B="urn:ietf:params:xml:ns:caldav">
  <A:prop xmlns:A="DAV:">
    <A:getetag/>
    <A:getcontenttype/>
  </A:prop>
  <B:filter>
    <B:comp-filter name="VCALENDAR">
      <B:comp-filter name="VEVENT">
        <B:time-range start="20131222T000000Z"/>
      </B:comp-filter>
    </B:comp-filter>
  </ 
<?xml version="1.0" encoding="utf-8" ?>
<d:multistatus xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav"><d:response><d:href>/dav/cmallatrait%40alinto.int/calendar/default/</d:href><d:propstat><d:prop><cs:getctag/><d:sync-token/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>REPORT /dav/cmallatrait%40alinto.int/calendar/default/ HTTP/1.1
Host: 192.168.0.174:8080
User-Agent: iOS/7.0.4 (11B554a) dataaccessd/1.0
Accept-Language: fr-fr
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return-minimal
Depth: 1
Connection: keep-alive
Cookie: miltonUserUrl=b64L2Rhdi9jbWFsbGF0cmFpdEBhbGludG8uaW50L3ByaW5jaXBhbA%3D%3D; miltonUserUrlHash="24e0fbc7-d2df-46dc-adb7-03cee261710b:OLxicSGr7Eho-Vk-90HWgqDKi5Y"
Content-Length: 390
Brief: t
 
<?xml version="1.0" encoding="UTF-8"?>
<B:calendar-query xmlns:B="urn:ietf:params:xml:ns:caldav">
  <A:prop xmlns:A="DAV:">
    <A:getetag/>
    <A:getcontenttype/>
  </A:prop>
  <B:filter>
    <B:comp-filter name="VCALENDAR">
      <B:comp-filter name="VEVENT">
        <B:time-range start="20131222T000000Z"/>
      </B:comp-filter>
    </B:comp-filter>
  </B:filter>
</B:calendar-query>

 

I was just, ok, seems fine, i'm asking to synchronize only the last month. The request send by the ipad seems fine with a start date. But the response still sent all the events, whatever the date is. After few times looking at everything, i found the CalendarQueryReport and saw this function : 

 

    private List<ICalResource> findCalendarResources(CalendarResource calendar, Document doc) throws NotAuthorizedException, BadRequestException {
        Date start;
        Date end;
 
        Element elFilterRoot = doc.getRootElement().getChild("filter", NS_CAL);
        if (elFilterRoot == null) {
            start = null;
            end = null;
        } else {
            Element elSecondFilter = elFilterRoot.getChild("comp-filter", NS_CAL);
            if (elSecondFilter == null) {
                start = null;
                end = null;
            } else {
                Element elTimeRange = elSecondFilter.getChild("time-range", NS_CAL);
                if (elTimeRange == null) {
                    start = null;
                    end = null;
                } else {
 
                    String sStart = elTimeRange.getAttributeValue("start");
                    String sFinish = elTimeRange.getAttributeValue("end");
                    if (sStart != null && sStart.length() > 0) {
                        try {
                            start = DateUtils.parseDate(sStart);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse start date in calendar-query: " + sStart);
                            start = null;
                        }
                    } else {
                        start = null;
                    }
 
                    if (sFinish != null && sFinish.length() > 0) {
                        try {
                            end = DateUtils.parseDate(sFinish);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse end date in calendar-query: " + sFinish);
                            end = null;
                        }
                    } else {
                        end = null;
                    }
                }
            }
        }
        return calendarSearchService.findCalendarResources(calendar, start, end);
 
    }
    private List<ICalResource> findCalendarResources(CalendarResource calendar, Document doc) throws NotAuthorizedException, BadRequestException {
        Date start;
        Date end;
 
        Element elFilterRoot = doc.getRootElement().getChild("filter", NS_CAL);
        if (elFilterRoot == null) {
            start = null;
            end = null;
        } else {
            Element elSecondFilter = elFilterRoot.getChild("comp-filter", NS_CAL);
            if (elSecondFilter == null) {
                start = null;
                end = null;
            } else {
                Element elTimeRange = elSecondFilter.getChild("time-range", NS_CAL);
                if (elTimeRange == null) {
                    start = null;
                    end = null;
                } else {
 
                    String sStart = elTimeRange.getAttributeValue("start");
                    String sFinish = elTimeRange.getAttributeValue("end");
                    if (sStart != null && sStart.length() > 0) {
                        try {
                            start = DateUtils.parseDate(sStart);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse start date in calendar-query: " + sStart);
                            start = null;
                        }
                    } else {
                        start = null;
                    }
 
                    if (sFinish != null && sFinish.length() > 0) {
                        try {
                            end = DateUtils.parseDate(sFinish);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse end date in calendar-query: " + sFinish);
                            end = null;
                        }
                    } else {
                        end = null;
                    }
                }
            }
        }
        return calendarSearchService.findCalendarResources(calendar, start, end);
 
    }

 

I think ( not sure, i'll be waiting for your answer to be sure :) ) you missed something here or something changed on the ipad/iphone format. This function checks if there is a filter ( here ok ) then checks the comp-filter ( still ok) and then try to find the child "time-range". Except the child of the comp-filter is another comp-filter. And the child of this second comp-filter is the time-range. This is why the iphone/ipad always display all the events and not only the last month's events.

 

I'm looking forward to hearing from you.

Best regards.

Robin LÉOS rleos@...

Java Developper

 

Alinto // email and more

15 quai Tilsitt - 69002 Lyon (France)

Tel. : +33(0)4 81 76 16 71 - Fax : +33(0)4 26 68 91 68

Site web : www.alinto.com

Blog : www.demainlemail.com

Suivez Alinto sur Twitter&Facebook




_______________________________________________
Milton-users mailing list
[hidden email]
http://lists.justthe.net/mailman/listinfo/milton-users
Reply | Threaded
Open this post in threaded view
|

Re: Bug when reporting events

bradmacnz
Hi Leon,

Sorry for the late reply, it looks like your email only just reached me now for some reason.

Something might have changed on the client side, that certainly worked before! I'll try to look at that over the next couple of days. Please ping me if you don't get a response.

/Brad


On 23/01/14 04:43, Robin Léos wrote:

Hey Brad !

How are you doing ? I'm Robin, i'm working with Charles Chahbazian at Alinto ! ( We already spoke about dav few months ago ) 

It seems i just saw  something odd in the CalendarQueryReport class. Let me explain. I tried to figure why our app always synchronize all the events, even if i said to my ipad to only get the last 6 months. So i isolated this with Wireshark :

<?xml version="1.0" encoding="utf-8" ?>
<d:multistatus xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav"><d:response><d:href>/dav/cmallatrait%40alinto.int/calendar/default/</d:href><d:propstat><d:prop><cs:getctag/><d:sync-token/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>REPORT /dav/cmallatrait%40alinto.int/calendar/default/ HTTP/1.1
Host: 192.168.0.174:8080
User-Agent: iOS/7.0.4 (11B554a) dataaccessd/1.0
Accept-Language: fr-fr
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return-minimal
Depth: 1
Connection: keep-alive
Cookie: miltonUserUrl=b64L2Rhdi9jbWFsbGF0cmFpdEBhbGludG8uaW50L3ByaW5jaXBhbA%3D%3D; miltonUserUrlHash="24e0fbc7-d2df-46dc-adb7-03cee261710b:OLxicSGr7Eho-Vk-90HWgqDKi5Y"
Content-Length: 390
Brief: t
 
<?xml version="1.0" encoding="UTF-8"?>
<B:calendar-query xmlns:B="urn:ietf:params:xml:ns:caldav">
  <A:prop xmlns:A="DAV:">
    <A:getetag/>
    <A:getcontenttype/>
  </A:prop>
  <B:filter>
    <B:comp-filter name="VCALENDAR">
      <B:comp-filter name="VEVENT">
        <B:time-range start="20131222T000000Z"/>
      </B:comp-filter>
    </B:comp-filter>
  </ 
<?xml version="1.0" encoding="utf-8" ?>
<d:multistatus xmlns:cs="http://calendarserver.org/ns/" xmlns:d="DAV:" xmlns:cal="urn:ietf:params:xml:ns:caldav" xmlns:card="urn:ietf:params:xml:ns:carddav"><d:response><d:href>/dav/cmallatrait%40alinto.int/calendar/default/</d:href><d:propstat><d:prop><cs:getctag/><d:sync-token/></d:prop><d:status>HTTP/1.1 404 Not Found</d:status></d:propstat></d:response></d:multistatus>REPORT /dav/cmallatrait%40alinto.int/calendar/default/ HTTP/1.1
Host: 192.168.0.174:8080
User-Agent: iOS/7.0.4 (11B554a) dataaccessd/1.0
Accept-Language: fr-fr
Accept-Encoding: gzip, deflate
Accept: */*
Content-Type: text/xml
Prefer: return-minimal
Depth: 1
Connection: keep-alive
Cookie: miltonUserUrl=b64L2Rhdi9jbWFsbGF0cmFpdEBhbGludG8uaW50L3ByaW5jaXBhbA%3D%3D; miltonUserUrlHash="24e0fbc7-d2df-46dc-adb7-03cee261710b:OLxicSGr7Eho-Vk-90HWgqDKi5Y"
Content-Length: 390
Brief: t
 
<?xml version="1.0" encoding="UTF-8"?>
<B:calendar-query xmlns:B="urn:ietf:params:xml:ns:caldav">
  <A:prop xmlns:A="DAV:">
    <A:getetag/>
    <A:getcontenttype/>
  </A:prop>
  <B:filter>
    <B:comp-filter name="VCALENDAR">
      <B:comp-filter name="VEVENT">
        <B:time-range start="20131222T000000Z"/>
      </B:comp-filter>
    </B:comp-filter>
  </B:filter>
</B:calendar-query>

 

I was just, ok, seems fine, i'm asking to synchronize only the last month. The request send by the ipad seems fine with a start date. But the response still sent all the events, whatever the date is. After few times looking at everything, i found the CalendarQueryReport and saw this function : 

 

    private List<ICalResource> findCalendarResources(CalendarResource calendar, Document doc) throws NotAuthorizedException, BadRequestException {
        Date start;
        Date end;
 
        Element elFilterRoot = doc.getRootElement().getChild("filter", NS_CAL);
        if (elFilterRoot == null) {
            start = null;
            end = null;
        } else {
            Element elSecondFilter = elFilterRoot.getChild("comp-filter", NS_CAL);
            if (elSecondFilter == null) {
                start = null;
                end = null;
            } else {
                Element elTimeRange = elSecondFilter.getChild("time-range", NS_CAL);
                if (elTimeRange == null) {
                    start = null;
                    end = null;
                } else {
 
                    String sStart = elTimeRange.getAttributeValue("start");
                    String sFinish = elTimeRange.getAttributeValue("end");
                    if (sStart != null && sStart.length() > 0) {
                        try {
                            start = DateUtils.parseDate(sStart);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse start date in calendar-query: " + sStart);
                            start = null;
                        }
                    } else {
                        start = null;
                    }
 
                    if (sFinish != null && sFinish.length() > 0) {
                        try {
                            end = DateUtils.parseDate(sFinish);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse end date in calendar-query: " + sFinish);
                            end = null;
                        }
                    } else {
                        end = null;
                    }
                }
            }
        }
        return calendarSearchService.findCalendarResources(calendar, start, end);
 
    }
    private List<ICalResource> findCalendarResources(CalendarResource calendar, Document doc) throws NotAuthorizedException, BadRequestException {
        Date start;
        Date end;
 
        Element elFilterRoot = doc.getRootElement().getChild("filter", NS_CAL);
        if (elFilterRoot == null) {
            start = null;
            end = null;
        } else {
            Element elSecondFilter = elFilterRoot.getChild("comp-filter", NS_CAL);
            if (elSecondFilter == null) {
                start = null;
                end = null;
            } else {
                Element elTimeRange = elSecondFilter.getChild("time-range", NS_CAL);
                if (elTimeRange == null) {
                    start = null;
                    end = null;
                } else {
 
                    String sStart = elTimeRange.getAttributeValue("start");
                    String sFinish = elTimeRange.getAttributeValue("end");
                    if (sStart != null && sStart.length() > 0) {
                        try {
                            start = DateUtils.parseDate(sStart);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse start date in calendar-query: " + sStart);
                            start = null;
                        }
                    } else {
                        start = null;
                    }
 
                    if (sFinish != null && sFinish.length() > 0) {
                        try {
                            end = DateUtils.parseDate(sFinish);
                        } catch (DateParseException ex) {
                            log.error("Couldnt parse end date in calendar-query: " + sFinish);
                            end = null;
                        }
                    } else {
                        end = null;
                    }
                }
            }
        }
        return calendarSearchService.findCalendarResources(calendar, start, end);
 
    }

 

I think ( not sure, i'll be waiting for your answer to be sure :) ) you missed something here or something changed on the ipad/iphone format. This function checks if there is a filter ( here ok ) then checks the comp-filter ( still ok) and then try to find the child "time-range". Except the child of the comp-filter is another comp-filter. And the child of this second comp-filter is the time-range. This is why the iphone/ipad always display all the events and not only the last month's events.

 

I'm looking forward to hearing from you.

Best regards.

Robin LÉOS rleos@...

Java Developper

 

Alinto // email and more

15 quai Tilsitt - 69002 Lyon (France)

Tel. : +33(0)4 81 76 16 71 - Fax : +33(0)4 26 68 91 68

Site web : www.alinto.com

Blog : www.demainlemail.com

Suivez Alinto sur Twitter&Facebook





_______________________________________________
Milton-users mailing list
[hidden email]
http://lists.justthe.net/mailman/listinfo/milton-users


_______________________________________________
Milton-users mailing list
[hidden email]
http://lists.justthe.net/mailman/listinfo/milton-users