Open
Description
We have a catch-all exception handler in our RCP and have had a few reports of an IllegalArgumentException
on setting the auto-update check schedule, e.g.
java.lang.IllegalArgumentException
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor.scheduleAtFixedRate(Unknown Source)
at java.base/java.util.concurrent.Executors$DelegatedScheduledExecutorService.scheduleAtFixedRate(Unknown Source)
at a.b.v.b.d.addUpdateCheck(d.java:34)
at org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdateScheduler.scheduleUpdate(AutomaticUpdateScheduler.java:156)
at org.eclipse.equinox.internal.p2.ui.sdk.scheduler.AutomaticUpdateScheduler.rescheduleUpdate(AutomaticUpdateScheduler.java:121)
at a.b.v.c.c.performOk(c.java:101)
at org.eclipse.jface.preference.PreferencePage.performApply(PreferencePage.java:454)
It's caused by being passed values <= 0. I've finally spotted what the issue is, it's in the calculation for the monthly schedule here:
private static final int ONE_HOUR_IN_MS = 60 * 60 * 1000;
private static final int ONE_DAY_IN_MS = 24 * ONE_HOUR_IN_MS;
The method is returning a long
but the calc is done with int
s where
30 * 24 * 60 * 60 * 1000 = 2,592,000,000
which is actually bigger than the int max value of 2,147,483,647
so overflow occurs and a negative result it actually returned.
Perhaps the constants should be changed to long
s or the calc changed to use 30L
...
Metadata
Metadata
Assignees
Labels
No labels