0

I need to clear the warning or say error message,which will be the best one to choose setMessage(null) or by using StringUtils.EMPTY - i just want to know the exact way of using StringUtils.EMPTY,it would be helpful...

Thanks & Regards.

  • 1
    Without seeing actual use case it is difficult to answer. I prefer using emptyObject/NullObject instead of null. So StringUtils.EMPTY is good choice. – Jayan Sep 18 '13 at 04:12

1 Answers1

0

Do not use null.

Since it's a message you might showing it some where,If you set it to null,it displays as "null" to end user.

Try like ,

private static final String EMPTY_STRING = "";

setMessage(EMPTY_STRING );

on there other hand you can check with isEmpty method,instead of checking null.

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307