java – Error converting the string to Calendar

I'm trying to convert a value of an HTML "input type" (which comes as a String) to a calendar value, but I'm not getting it. Detail, I'm trying to do this inside a Servlet, I do not know if that has something out there.

Many examples I have seen that used Try / Catch, but in my case always falls in the Catch. And if you do not use the Try / Catch, the error "unhandle exception type parseexception" is displayed

Flight flight = new Flight ();
voo.setOrigem (request.getParameter ("source"));
voo.setDestino (request.getParameter ("destination"));

test {

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

String data = request.getParameter ("heading");

Calendar c = Calendar.getInstance ();

c.setTime (formatData.parse (data));

voo.setDataPartida (c);


} catch (Exception e) {}

} 

With the Try / Catch it does not present an error, but it always falls in the Catch, and shows an error "java.lang.NullPointerException" when executing the project.

But if you do not use the Try / Catch as it is below, you already point to the error "unhandle exception type parseexception"

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

String data = request.getParameter ("heading");

Calendar c = Calendar.getInstance ();

c.setTime (formatData.parse (data));

voo.setDataPartida (c);