Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
    Bookmark Topic Watch Topic
  • New Topic

Number formmat exception

 
vishal naik
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Report post to moderator
//attribute of type string.It gives me a number format exception
Date date=null;
try
{
SimpleDateFormat df=new SimpleDateFormat("MM/dd/yyyy");
date=df.parse(attribute);
if(attribute==null||!(date instanceof Date))
{
System.out.println("Reject the record");
break;
}
else
BOBroadbandAdviceNoteDataObj.setAdv_note_date(new Date(attribute));
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
What is the value of "attribute"?

What is the point of checking it for null after it has been parsed (which assumes that it is not null)?
 
    Bookmark Topic Watch Topic
  • New Topic