Consider rewrite for checking non-emptiness of strings
lyxell opened this issue · 1 comments
lyxell commented
in e.g. struts bundles/admin/src/main/java/org/apache/struts2/osgi/admin/actions/ShellAction.java
we currently suggest
errStream.close();
}
- output = errString != null && errString.length() > 0 ? errString : outString;
+ output = errString != null && !errString.isEmpty() ? errString : outString;
return Action.SUCCESS;
}
This could maybe be improved to
errStream.close();
}
- output = errString != null && errString.length() > 0 ? errString : outString;
+ output = "".equals(errString) ? outString : errString;
return Action.SUCCESS;
}
lyxell commented
Nevermind, expressions are not equivalent