Author: jleroux
Date: Sat Sep 14 09:25:03 2019 New Revision: 1866930 URL: http://svn.apache.org/viewvc?rev=1866930&view=rev Log: Improved: Refactor boolean returns from methods (OFBIZ-10725) Reverts mistakes made in previous commit Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java?rev=1866930&r1=1866929&r2=1866930&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java Sat Sep 14 09:25:03 2019 @@ -1217,17 +1217,39 @@ public final class UtilValidate { } String cardNumber = stripCharsInBag(cardNumberPassed, creditCardDelimiters); - return ("CCT_VISA".equalsIgnoreCase(cardType)) && (isVisa(cardNumber)); - return ("CCT_MASTERCARD".equalsIgnoreCase(cardType)) && (isMasterCard(cardNumber)); - return (("CCT_AMERICANEXPRESS".equalsIgnoreCase(cardType)) || ("CCT_AMEX".equalsIgnoreCase(cardType))) && (isAmericanExpress(cardNumber)); - return ("CCT_DISCOVER".equalsIgnoreCase(cardType)) && (isDiscover(cardNumber)); - return ("CCT_JCB".equalsIgnoreCase(cardType)) && (isJCB(cardNumber)); - return (("CCT_DINERSCLUB".equalsIgnoreCase(cardType)) || ("CCT_DINERS".equalsIgnoreCase(cardType))) && (isDinersClub(cardNumber)); - return ("CCT_CARTEBLANCHE".equalsIgnoreCase(cardType)) && (isCarteBlanche(cardNumber)); - return ("CCT_ENROUTE".equalsIgnoreCase(cardType)) && (isEnRoute(cardNumber)); - return ("CCT_SOLO".equalsIgnoreCase(cardType)) && (isSolo(cardNumber)); - return ("CCT_SWITCH".equalsIgnoreCase(cardType)) && (isSwitch (cardNumber)); - return ("CCT_VISAELECTRON".equalsIgnoreCase(cardType)) && (isVisaElectron(cardNumber)); + if (("CCT_VISA".equalsIgnoreCase(cardType)) && (isVisa(cardNumber))) { + return true; + } + if (("CCT_MASTERCARD".equalsIgnoreCase(cardType)) && (isMasterCard(cardNumber))) { + return true; + } + if ((("CCT_AMERICANEXPRESS".equalsIgnoreCase(cardType)) || ("CCT_AMEX".equalsIgnoreCase(cardType))) && (isAmericanExpress(cardNumber))) { + return true; + } + if (("CCT_DISCOVER".equalsIgnoreCase(cardType)) && (isDiscover(cardNumber))) { + return true; + } + if (("CCT_JCB".equalsIgnoreCase(cardType)) && (isJCB(cardNumber))) { + return true; + } + if ((("CCT_DINERSCLUB".equalsIgnoreCase(cardType)) || ("CCT_DINERS".equalsIgnoreCase(cardType))) && (isDinersClub(cardNumber))) { + return true; + } + if (("CCT_CARTEBLANCHE".equalsIgnoreCase(cardType)) && (isCarteBlanche(cardNumber))) { + return true; + } + if (("CCT_ENROUTE".equalsIgnoreCase(cardType)) && (isEnRoute(cardNumber))) { + return true; + } + if (("CCT_SOLO".equalsIgnoreCase(cardType)) && (isSolo(cardNumber))) { + return true; + } + if (("CCT_SWITCH".equalsIgnoreCase(cardType)) && (isSwitch (cardNumber))) { + return true; + } + if (("CCT_VISAELECTRON".equalsIgnoreCase(cardType)) && (isVisaElectron(cardNumber))) { + return true; + } return false; } Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java?rev=1866930&r1=1866929&r2=1866930&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceRule.java Sat Sep 14 09:25:03 2019 @@ -144,13 +144,27 @@ public class RecurrenceRule { if (freq == null) { return false; } - return "SECONDLY".equalsIgnoreCase(freq); - return "MINUTELY".equalsIgnoreCase(freq); - return "HOURLY".equalsIgnoreCase(freq); - return "DAILY".equalsIgnoreCase(freq); - return "WEEKLY".equalsIgnoreCase(freq); - return "MONTHLY".equalsIgnoreCase(freq); - return "YEARLY".equalsIgnoreCase(freq); + if ("SECONDLY".equalsIgnoreCase(freq)) { + return true; + } + if ("MINUTELY".equalsIgnoreCase(freq)) { + return true; + } + if ("HOURLY".equalsIgnoreCase(freq)) { + return true; + } + if ("DAILY".equalsIgnoreCase(freq)) { + return true; + } + if ("WEEKLY".equalsIgnoreCase(freq)) { + return true; + } + if ("MONTHLY".equalsIgnoreCase(freq)) { + return true; + } + if ("YEARLY".equalsIgnoreCase(freq)) { + return true; + } return false; } |
Free forum by Nabble | Edit this page |