[ 
https://issues.apache.org/jira/browse/CAMEL-24343?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andrea Cosentino updated CAMEL-24343:
-------------------------------------
    Fix Version/s: 4.22.0

> camel-google-calendar: stream consumer can skip events and only reads the 
> first page
> ------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24343
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24343
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-google-calendar
>            Reporter: Andrea Cosentino
>            Assignee: Andrea Cosentino
>            Priority: Major
>             Fix For: 4.22.0
>
>
> {{GoogleCalendarStreamConsumer}} can silently skip events when 
> {{considerLastUpdate=true}}:
> {code:java}
> // GoogleCalendarStreamConsumer.java:154-167
> if (!dateList.isEmpty()) {
>     ...
>     calendar.add(java.util.Calendar.SECOND, 1);
>     finalLastUpdate = calendar.getTime();
> } else {
>     finalLastUpdate = new Date();
> }
> {code}
> * On a poll that returns no events the cursor is advanced to the local {{new 
> Date()}}, so any event updated between the previous poll and "now" (including 
> clock-skew between the local machine and Google) is never delivered.
> * On a non-empty poll the cursor is set to the newest event's update time 
> plus one second, so events updated in that same second are skipped.
> In addition, the non-sync branch never follows the page token:
> {code:java}
> // GoogleCalendarStreamConsumer.java:134
> c = request.setOrderBy("updated").execute();
> {code}
> Only the first page (maxResults, default 10) is ever consumed, and because 
> the cursor still advances the remainder is dropped.
> Two smaller issues in the same class:
> * The 410 (invalid sync token) handler recurses into itself, {{return 
> poll();}} at :117, with no bound.
> * {{c.getItems()}} is dereferenced without a null check at :123 and :138.
> Found during a source audit of the {{components/camel-google}} module family 
> against main @ c3b01310be15.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to