A: 

Nothing will break if you use them...yet.

But they may well be removed in future versions.

Visage
most of the Date related deprecations are due to bugs, so things might break because of the bugs
fuzzy lollipop
+2  A: 

What "Deprecated" Means

You may have heard the term, "self-deprecating humor," or humor that minimizes the speaker's importance. A deprecated class or method is like that. It is no longer important. It is so unimportant, in fact, that you should no longer use it, since it has been superseded and may cease to exist in the future.

Java provides a way to express deprecation because, as a class evolves, its API (application programming interface) inevitably changes: methods are renamed for consistency, new and better methods are added, and fields change. But such changes introduce a problem. You need to keep the old API around until developers make the transition to the new one, but you don't want them to continue programming to the old API.

The ability to deprecate a class, method, or member field solves the problem. Java supports two mechanisms for deprecation: and an annotation, (supported starting with J2SE 5.0) and a Javadoc tag (supported since 1.1). Existing calls to the old API continue to work, but the annotation causes the compiler to issue a warning when it finds references to deprecated program elements. The Javadoc tag and associated comments warn users against using the deprecated item and tell them what to use instead.them what to use instead.

http://download-llnw.oracle.com/javase/1.5.0/docs/guide/javadoc/deprecation/deprecation.html

Jonathon
+4  A: 

You're right that this is bad practice. In almost all cases, deprecated methods tell you what to use instead, and this is no exception (see the Javadocs).

You're trying to create a Date out of a String. But what format is the String in? How should it be parsed? Is it UK or US date format?

The "proper" way to do this is to create an instance of SimpleDateFormat, and call its parse() method passing in your text string. This is guaranteed to work in future, and will be more robust now.

Andrzej Doyle
... or preferably, use a better API such as Joda Time :)
Jon Skeet
Well... yes. :-) But suggesting rewriting all existing code to use new Date objects is overkill for *this* situation.
Andrzej Doyle
@Jon Skeet, the problems with always using Better API is you end up having a directory of API's and constantly having to check for new releases in repositories.
The Elite Gentleman
@The Elite Gentleman: While I agree you can get into problems in general, Joda Time is stable and *so* much better than the existing API, it's definitely worth doing. It's a *massive* step up from java.util.Date/Calendar.
Jon Skeet
+1  A: 

Deprecated objects or methods merely means that if you want to use it in current project, rather use what is recommended. The reason why they still have it is for legacy codes who have used the deprecated method before it was deprecated. Typical example is StringTokenizer vs String.split() method.

For your Date example use SimpleDateFormat to do conversion from String to Date. This allows you to create a date format from which your string date can be parsed to create a Date object.


For your EDIT do this

SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); 

model.setDate(formatter.parse(request.getParameter("date")));

ParseException is caused since you didn't provide a date format structure so the SimpleDateFormat didn't know how your date was structured.

The Elite Gentleman
Shouldn't it be MM/dd/yyyy?
CoolBeans
@CoolBeans, true....I edited the change.
The Elite Gentleman
+1  A: 

Deprecated means it is planned for removal, because it is buggy or some other bad reason. It is better to use SimpleDateFormat.parse(); to parse your strings.

fuzzy lollipop
+1  A: 

In general, when Sun (Oracle, whatever) declares a Java method deprecated, it means that they changed their minds about including it, they discourage you from using it, and they may remove it in some future version. Of course it's likely to be a long time before it gets removed as who knows how much existing code there is out there using it, and what's the point of breaking existing programs just because the inventors of Java think they now have a better idea about how to do something?

Presumably they had a good reason for deprecating something, so you should investigate WHY they say that some newer function is better.

In the case of deprecated Date methods, usually this means that they suggest you now use the Calendar or SimpleDateFormat classes. In your case, probably the latter.

Jay
+2  A: 

You are right, Its discouraged to use deprecated methods. This is because these methods may have issues in some situation or have been replaced with more optimistic solutions And also future versions may not support these.

YoK
A: 
Dean J
+1  A: 

A lot of people have mentioned what Deprecated means, but I don't see any explanation of why these methods are deprecated:

Sun (before they were part of Oracle) deprecated a number of methods in Date to get people to use the Calendar/GregorianCalendar classes for date manipulation instead.

R. Bemrose