Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2509

determineInitialDelay mixes System.currentTimeInMilis and JodaTime time mechanism

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 4.4.0.Final
    • JCR
    • None

      In our project we have a time based test case. We use Jodatime, and we set the time as following:

      DateTimeUtils.setCurrentMillisFixed(1443513561000L);
      

      We then create a new ModeShapeEngine(), which in turn creates a new JcrRepository, etc. After hitting the postInitialize() it calls determineInitialDelay(), which fails due an assertion error.

      Within determineInitialDelay() we fail the assert:

      assert delay >= 0;
      

      Which is on line 1987 in file JcrRepository.java

      We believe this happens due the usage of System.currentTimeMillis and DateTime now from jodatime.

      Although we had a discussion weather not to use Jodatime to fix time like this, we think it is confusing to mix up the two methods in Modeshape. Perhaps some decision can be made, either fix or not. And perhaps some ideas can be given about how to test time-related features.

              Unassigned Unassigned
              stefanhendriks Stefan Hendriks (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: