lundi 2 avril 2018

How to handle empty response from DB in java?

I am fetching value from db in dbval variable. so I want to add condition, pass the case if the value = apple or the value is empty or null. but if the value is diff like orange or mange, throw error. Please help. my code:

if (StringUtils.equals(apple, dbval) || dbval.equalsIgnoreCase(null) || dbval.isEmpty()) 
{
    dbValueFlag = true;
    logger.info("DB value matched ",);
} 
else 
{
    logger.info("DB valuenot matched for pnac");
}

Thanks!

Aucun commentaire:

Enregistrer un commentaire