Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3761624
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:39:17+00:00 2026-05-19T10:39:17+00:00

I hope following explanation will make sense because it’s a weird problem we’re facing

  • 0

I hope following explanation will make sense because it’s a weird problem we’re facing and hard to describe.

We have a maven project which gets build in hudson and that contains some unit tests where dates are used and asserted. The hudson server runs on solaris. Now, occasionally (like 30% of the times) the unit tests using dates fail because 3,5 hours are deducted from the specified time in the unit test and hence asserts start failing. The other 70% everything works fine although nothing at all changed in the code and we run the hudson job several times an hour.

I add following code to a unittest to check the time:

@Test
public void testDate() {
    System.out.println("new DateMidnight(2011, 1, 5).toDate();");
    System.out.println(new DateMidnight(2011, 1, 5).toDate());
    System.out.println(new DateMidnight(2011, 1, 5).toDate().getTime());

    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 2011);
    cal.set(Calendar.MONTH, 0);
    cal.set(Calendar.DAY_OF_MONTH, 5);
    cal.set(Calendar.HOUR, 0);
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.SECOND, 0);
    cal.set(Calendar.MILLISECOND, 0);
    System.out.println("cal.getTime();");
    System.out.println(cal.getTime());
    System.out.println(cal.getTime().getTime());
}

So basically it should print the same thing when using jodatime or plain old Calendar. This is the case in 70% of the runs; for the other 30% I get following printouts:

Running TestSuite
new DateMidnight(2011, 1, 5).toDate();
Tue Jan 04 21:30:00 MET 2011
1294173000000
cal.getTime();
Wed Jan 05 12:00:00 MET 2011
1294225200000

So, Calendar keeps the correct date and time but jodatime deducts 3,5 hours.

Local maven tests never appear the pose this problem and we can’t figure out what could be the cause of it. Especially, we can’t think of a single reason why the tests sometimes pass and sometimes fail without changing any code nor hudson or server setting.

Also, we run the maven install with cobertura which means that the unit tests are run twice. It happens also that they pass the first time and fail the second time or the other way around or that they fail both times.

Thanks for any solutions or tips to track down the cause,
Stijn

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:39:18+00:00Added an answer on May 19, 2026 at 10:39 am

    The problem seems to be fixed now.

    We’ve upgraded our jodatime version from 5.14.2 to 5.14.6.
    Since then I ran the build on auto each half hour so after about a 100 runs we never encountered this problem again.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem and I hope someone will be able to help
I have the following problem and hope someone could help. I have a SQL
I couldn't find any explanation for the following problem. Hope you to help me
i have a problem with Dictionary, hope you'll help me. I have the following
This will take a bit of explanation so I hope I don't lose everyone
I'm using Fancybox and Zend. Hope the following is clear. On www.example.com/template/edit/id/3 I have
I currently have the following method in a class which I hope I can
I hope I can explain this clearly: I have two tables with the following
The following is a theoretical question, that I hope someone will be able to
I hope the following isn't too tricky. I have a simple html button. Now

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.