This is my debugging code:
log.error(u.getName() + " - " + u.getName().length() + " - host_node" + " - " + u.equals("host_node"));
My log:
11:27:16 [main] ERROR com.google - host_node - 9 - host_node - false
Why it doesn't equal, I am even checking length, to see if first contains whitespaces. But it does not.
I would use following as I suspect u
is not a String
.
u.getName().equals("host_node")
or better you can use the following to get false
if the name is null
.
"host_node".equals(u.getName())