You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by milapfk <gi...@git.apache.org> on 2016/07/17 05:27:23 UTC

[GitHub] ignite pull request #871: IGNITE-2527 - fixed

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 <mi...@flipkart.com>
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 <mi...@flipkart.com>
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.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---