dimanche 28 juin 2015

Java executing only last part of if condition

I'm a java beginner. i face the below issue.

I'm setting the remarks and returning the response, but i only get the remarks printed as Date is invalid for all the iterations. if i pass all inputs as empty it has to print just ID is empty but it prints Date is invalid all the time

 public Response getInfoDetails(RequestDetails request)
{
Response response = new Response();
if(Utils.isEmpty(request.getID()))
{
response.setREMARKS("ID is empty);
}

 if(Utils.isEmpty(request.getName()))
 {
 response.setREMARKS("Name is empty);
}
if(Utils.isIpAddressValid(request.getIP()))
{
response.setREMARKS("IP is invalid");
}
if(Utils.isDateValid(request.getDate()))
{
response.setREMARKS("Date is invalid");
}
return response;
}

please advise

Thanks

Aucun commentaire:

Enregistrer un commentaire