Fix the anti-pattern
if (* != null && *.size() > 0) {
where * is a variable name (String or Collection). Rewritten to
if (UtilValidate.isNotEmpty(*)) {
Done with Eclipse regex replace feature with
search = if \((\w+) *!= *null *&& *(\w+)\.size\(\) *> *0\) *\{
replace = if (UtilValidate.isNotEmpty($1)) {
And of course some hand-work for imports and cleaning. I compiled and tested with ant run-tests
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@686591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -382,7 +382,7 @@ public class WebToolsServices {
|
||||
List<Object> errorMessages = FastList.newInstance();
|
||||
List<String> infoMessages = FastList.newInstance();
|
||||
int totalRowsChanged = 0;
|
||||
if (urlList != null && urlList.size() > 0) {
|
||||
if (UtilValidate.isNotEmpty(urlList)) {
|
||||
messages.add("=-=-=-=-=-=-= Doing a data " + (checkDataOnly ? "check" : "load") + " with the following files:");
|
||||
for (URL dataUrl: urlList) {
|
||||
messages.add(dataUrl.toExternalForm());
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.ofbiz.service.DispatchContext;
|
||||
import org.ofbiz.base.util.UtilHttp;
|
||||
import org.ofbiz.base.util.GeneralException;
|
||||
import org.ofbiz.base.util.Debug;
|
||||
import org.ofbiz.base.util.UtilMisc;
|
||||
import org.ofbiz.base.util.UtilValidate;
|
||||
import org.ofbiz.entity.GenericValue;
|
||||
import org.ofbiz.entity.GenericEntityException;
|
||||
import org.ofbiz.widget.screen.ScreenRenderer;
|
||||
@@ -54,7 +54,7 @@ public class FoPrintServerEvents {
|
||||
reqParams.put("locale", UtilHttp.getLocale(req));
|
||||
|
||||
String screenUri = (String) reqParams.remove("screenUri");
|
||||
if (screenUri != null && reqParams.size() > 0) {
|
||||
if (UtilValidate.isNotEmpty(screenUri)) {
|
||||
String base64String = null;
|
||||
try {
|
||||
byte[] bytes = FoPrintServerEvents.getXslFo(dispatcher.getDispatchContext(), screenUri, reqParams);
|
||||
|
||||
Reference in New Issue
Block a user