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 409405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:47:14+00:00 2026-05-12T17:47:14+00:00

Are there any gotchas in JDK 6 which did not exist in earlier versions?

  • 0

Are there any gotchas in JDK 6 which did not exist in earlier versions? I am interested in finding out some surprising changes like the following one in the way Timestamp.valueOf() works.

Timestamp.valueOf(), when provided with a timestamp which contains a date or a month with a single digit. eg. 2009-9-20, 2009-9-3, 2009-12-4 etc., behaves differently in JDK 6 – it throws an IllegalArgumentException saying that the timestamp is not properly formatted. Whereas JDK 5 (and earlier versions) works just fine providing the proper values with ‘0’ prefixed to those single digit numbers.

JDK 6 is just being more strict because the method does expect it’s argument to be a String in JDBC timestamp escape format. However, this BREAKS code written in JDK 5.

Code like:

String s = "2009-9-1 00:00:00";
Timestamp t = Timestamp.valueOf(s);

However JDK 6 is fine with hours, minutes, seconds being single digits. I have figured out what’s wrong by looking at the source code of Timestamp class in JDK 6. I found an array intDate[] which is initialized to {4,2,2} and the length of each item in the date is checked against this array.

Now why did the time part work fine even when there are single digits in them? Because the code that checks the length against an equivalent array intTime[] is commented out in source.

The Timestamp class in JDK 5 did not have any of these checks and work just fine with such inputs.

I do not find such oddities mentioned anywhere in the official site. Though I found one other person having the same problem. This problem is easily fixable and I am interested in finding out other such odd changes that had happened in JDK 6.

  • 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-12T17:47:14+00:00Added an answer on May 12, 2026 at 5:47 pm

    Officially, this

    EDIT

    Additionally you can take a look at Sun’s bug database.

    This link shows items in Java of type bug with status accepted and the keywords “1.6 1.5”

    I check a few of them and it looks like what you need.

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

Sidebar

Related Questions

Does this work well as a Singleton in actionscript? i.e. are there any gotchas
Is there any difference (compiler/interpreter/juju wise, etc) between the two versions of checking the
Are there any gotchas I should be aware of when running Python scripts from
Are there any gotchas using mvvm-light and the RTW windows phone 7 tools? There
I'm wondering if there any gotchas or something like this with plain java new
Is there any downside to using NSSet as key in NSMutableDictionary , any gotchas
Does Silverlight work with IE 6, are there any gotchas? Just wondering if this
Are there any reasons not to reuse an NServiceBus message ( IMessage ) in
Are there any tools which help manage plain old c structures? I have a
This one is for Boost experts. Are there any gotchas or details that the

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.