[
https://issues.apache.org/jira/browse/IGNITE-2527?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15381101#comment-15381101
]
ASF GitHub Bot commented on IGNITE-2527:
----------------------------------------
GitHub user milapfk opened a pull request:
https://github.com/apache/ignite/pull/871
IGNITE-2527 - fixed
Issue:
Calling {{SchedulerFuture.nextExecutionTime()}} (and probably other
methods) on a completed future leads to this exception:
{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at
org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:455)
{noformat}
In particular, this happens if {{nextExecutionTime()}} right after calling
{{IgniteScheduler.scheduleLocal()}} with an invalid pattern (see code example
below). The exception is lost in this case and is never printed out or thrown.
{code}
SchedulerFuture schedulerFuture = ignite.scheduler().scheduleLocal(() ->
{}, "{55} 53 3/5 * * *");
long nextExecutionTime = schedulerFuture.nextExecutionTime();
{code}
Root Cause:
schedulerFuture.nextExecutionTime() is trying to caste Empty Array element
(first element) to Long. Thats why It is throwing ArrayOutOfBoundException
schedulerFuture.nextExecutionTime() internally invokes nextExecutionTimes()
which in case If scheduler is finished will returns Empty Long Array.
As schedulerFuture.nextExecutionTime() returns Long, It has to caste Array
Elements returned from nextExecutionTimes() to Long which is empty in this
case. Hence throwing ArrayOutOfBoundException
Resolution:
keeping schedulerFuture.nextExecutionTime() default termination value as -1.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/milapfk/ignite master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/ignite/pull/871.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #871
----
commit 8a54842c05a68bb065e599af1e92617897e4ab70
Author: milap.wadhwa <[email protected]>
Date: 2016-07-17T05:18:12Z
Issue[IGNITE-2527]:
Calling {{SchedulerFuture.nextExecutionTime()}} (and probably other
methods) on a completed future leads to this exception:
{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at
org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:455)
{noformat}
In particular, this happens if {{nextExecutionTime()}} right after calling
{{IgniteScheduler.scheduleLocal()}} with an invalid pattern (see code example
below). The exception is lost in this case and is never printed out or thrown.
{code}
SchedulerFuture schedulerFuture = ignite.scheduler().scheduleLocal(() ->
{}, "{55} 53 3/5 * * *");
long nextExecutionTime = schedulerFuture.nextExecutionTime();
{code}
Root Cause:
schedulerFuture.nextExecutionTime() is trying to caste Empty Array element
(first element) to Long. Thats why It is throwing ArrayOutOfBoundException
schedulerFuture.nextExecutionTime() internally invokes nextExecutionTimes()
which in case If scheduler is finished will returns Empty Long Array.
As schedulerFuture.nextExecutionTime() returns Long, It has to caste Array
Elements returned from nextExecutionTimes() to Long which is empty in this
case. Hence throwing ArrayOutOfBoundException
Resolution:
keeping schedulerFuture.nextExecutionTime() default termination value as -1.
commit d5b0839b183c8ea0c5b330de6d350d9bc4cc2dd9
Author: milap.wadhwa <[email protected]>
Date: 2016-07-17T05:29:40Z
IGNITE-2527 -fixed :
Calling {{SchedulerFuture.nextExecutionTime()}} (and probably other
methods) on a completed future leads to this exception:
{noformat}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at
org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:455)
{noformat}
In particular, this happens if {{nextExecutionTime()}} right after calling
{{IgniteScheduler.scheduleLocal()}} with an invalid pattern (see code example
below). The exception is lost in this case and is never printed out or thrown.
{code}
SchedulerFuture schedulerFuture = ignite.scheduler().scheduleLocal(() ->
{}, "{55} 53 3/5 * * *");
long nextExecutionTime = schedulerFuture.nextExecutionTime();
{code}
Root Cause:
schedulerFuture.nextExecutionTime() is trying to caste Empty Array element
(first element) to Long. Thats why It is throwing ArrayOutOfBoundException
schedulerFuture.nextExecutionTime() internally invokes nextExecutionTimes()
which in case If scheduler is finished will returns Empty Long Array.
As schedulerFuture.nextExecutionTime() returns Long, It has to caste Array
Elements returned from nextExecutionTimes() to Long which is empty in this
case. Hence throwing ArrayOutOfBoundException
Resolution:
keeping schedulerFuture.nextExecutionTime() default termination value as -1.
----
> IndexOutOfBoundsException in scheduler future
> ---------------------------------------------
>
> Key: IGNITE-2527
> URL: https://issues.apache.org/jira/browse/IGNITE-2527
> Project: Ignite
> Issue Type: Bug
> Components: general
> Reporter: Valentin Kulichenko
> Assignee: Milap Wadhwa
> Priority: Minor
> Fix For: 1.7
>
>
> Calling {{SchedulerFuture.nextExecutionTime()}} (and probably other methods)
> on a completed future leads to this exception:
> {noformat}
> Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
> at
> org.apache.ignite.internal.processors.schedule.ScheduleFutureImpl.nextExecutionTime(ScheduleFutureImpl.java:455)
> {noformat}
> In particular, this happens if {{nextExecutionTime()}} right after calling
> {{IgniteScheduler.scheduleLocal()}} with an invalid pattern (see code example
> below). The exception is lost in this case and is never printed out or thrown.
> {code}
> SchedulerFuture schedulerFuture = ignite.scheduler().scheduleLocal(() -> {},
> "{55} 53 3/5 * * *");
> long nextExecutionTime = schedulerFuture.nextExecutionTime();
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)