You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2023/05/19 08:27:38 UTC

[ofbiz-framework] branch trunk updated: Fixed: Reducing scope of variables in common and base packages (OFBIZ-10477) (OFBIZ-10480)

This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b034edd2ab Fixed: Reducing scope of variables in common and base packages (OFBIZ-10477) (OFBIZ-10480)
b034edd2ab is described below

commit b034edd2ab59cfbcf4e28400358c6cd30af5b2dd
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Fri May 19 09:51:58 2023 +0200

    Fixed: Reducing scope of variables in common and base packages (OFBIZ-10477) (OFBIZ-10480)
    
    Following  https://lists.apache.org/thread/g1z92gtlf9p1rxlc247yg2zqd6bczq7s
    conversation, this fixes SAFE util methods being transformed to private
    when obviously they should be public
    
    Thanks: Michael for spotting, reporting and confirming it's OK
---
 .../org/apache/ofbiz/base/util/StringUtil.java     |  5 ++-
 .../org/apache/ofbiz/base/util/UtilDateTime.java   | 16 ++++----
 .../org/apache/ofbiz/base/util/UtilFormatOut.java  | 32 +++++++++------
 .../java/org/apache/ofbiz/base/util/UtilHttp.java  |  8 ++--
 .../java/org/apache/ofbiz/base/util/UtilMisc.java  |  4 +-
 .../org/apache/ofbiz/base/util/UtilNumber.java     |  8 ++--
 .../java/org/apache/ofbiz/base/util/UtilTimer.java | 12 +++---
 .../java/org/apache/ofbiz/base/util/UtilURL.java   |  2 +-
 .../org/apache/ofbiz/base/util/UtilValidate.java   | 48 +++++++++++-----------
 .../org/apache/ofbiz/common/geo/GeoWorker.java     | 11 ++---
 10 files changed, 78 insertions(+), 68 deletions(-)

diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
index 9715ba2318..8179fdcced 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/StringUtil.java
@@ -143,7 +143,7 @@ public final class StringUtil {
      * @param trim Trim whitespace off fields
      * @return a Map of name/value pairs
      */
-    private static Map<String, String> strToMap(String str, String delim, boolean trim) {
+    public static Map<String, String> strToMap(String str, String delim, boolean trim) {
         return strToMap(str, delim, trim, null);
 
     }
@@ -157,7 +157,7 @@ public final class StringUtil {
      *        and want to replace "=" to avoid clashes with parameters values in a not encoded URL, default to "="
      * @return a Map of name/value pairs
      */
-    private static Map<String, String> strToMap(String str, String delim, boolean trim, String pairsSeparator) {
+    public static Map<String, String> strToMap(String str, String delim, boolean trim, String pairsSeparator) {
         if (UtilValidate.isEmpty(str)) {
             return null;
         }
@@ -445,6 +445,7 @@ public final class StringUtil {
         /**
          * @return true, if wrapped string is null or empty; false otherwise
          */
+        @Override
         public boolean isEmpty() {
             return (theString == null || theString.isEmpty());
         }
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java
index 7f4cb2fcf3..9ced64d53a 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilDateTime.java
@@ -617,7 +617,7 @@ public final class UtilDateTime {
      * @param date The Date
      * @return A time String in the format HH:MM:SS or HH:MM
      */
-    private static String toTimeString(java.util.Date date) {
+    public static String toTimeString(java.util.Date date) {
         if (date == null) {
             return "";
         }
@@ -635,7 +635,7 @@ public final class UtilDateTime {
      * @param second The second int
      * @return A time String in the format HH:MM:SS or HH:MM
      */
-    private static String toTimeString(int hour, int minute, int second) {
+    public static String toTimeString(int hour, int minute, int second) {
         String hourStr;
         String minuteStr;
         String secondStr;
@@ -816,7 +816,7 @@ public final class UtilDateTime {
         return getWeekStart(stamp, daysLater, 0, timeZone, locale);
     }
 
-    private static Timestamp getWeekStart(Timestamp stamp, int daysLater, int weeksLater, TimeZone timeZone, Locale locale) {
+    public static Timestamp getWeekStart(Timestamp stamp, int daysLater, int weeksLater, TimeZone timeZone, Locale locale) {
         Calendar tempCal = toCalendar(stamp, timeZone, locale);
         tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
         tempCal.add(Calendar.DAY_OF_MONTH, daysLater);
@@ -842,7 +842,7 @@ public final class UtilDateTime {
         return getMonthStart(stamp, daysLater, 0, timeZone, locale);
     }
 
-    private static Timestamp getMonthStart(Timestamp stamp, int daysLater, int monthsLater, TimeZone timeZone, Locale locale) {
+    public static Timestamp getMonthStart(Timestamp stamp, int daysLater, int monthsLater, TimeZone timeZone, Locale locale) {
         Calendar tempCal = toCalendar(stamp, timeZone, locale);
         tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), 1, 0, 0, 0);
         tempCal.add(Calendar.MONTH, monthsLater);
@@ -875,7 +875,7 @@ public final class UtilDateTime {
                 ? 0 : monthsLater.intValue()), (yearsLater == null ? 0 : yearsLater.intValue()), timeZone, locale);
     }
 
-    private static Timestamp getYearStart(Timestamp stamp, int daysLater, int monthsLater, int yearsLater, TimeZone timeZone, Locale locale) {
+    public static Timestamp getYearStart(Timestamp stamp, int daysLater, int monthsLater, int yearsLater, TimeZone timeZone, Locale locale) {
         Calendar tempCal = toCalendar(stamp, timeZone, locale);
         tempCal.set(tempCal.get(Calendar.YEAR), Calendar.JANUARY, 1, 0, 0, 0);
         tempCal.add(Calendar.YEAR, yearsLater);
@@ -892,7 +892,7 @@ public final class UtilDateTime {
         return getMonthEnd(new Timestamp(tempCal.getTimeInMillis()), timeZone, locale);
     }
 
-    private static int weekNumber(Timestamp stamp, TimeZone timeZone, Locale locale) {
+    public static int weekNumber(Timestamp stamp, TimeZone timeZone, Locale locale) {
         Calendar tempCal = toCalendar(stamp, timeZone, locale);
         return tempCal.get(Calendar.WEEK_OF_YEAR);
     }
@@ -997,7 +997,7 @@ public final class UtilDateTime {
     /**
      * Localized String to Timestamp conversion. To be used in tandem with timeStampToString().
      */
-    private static Timestamp stringToTimeStamp(String dateTimeString, String dateTimeFormat, TimeZone tz, Locale locale) throws ParseException {
+    public static Timestamp stringToTimeStamp(String dateTimeString, String dateTimeFormat, TimeZone tz, Locale locale) throws ParseException {
         DateFormat dateFormat = toDateTimeFormat(dateTimeFormat, tz, locale);
         Date parsedDate = dateFormat.parse(dateTimeString);
         return new Timestamp(parsedDate.getTime());
@@ -1013,7 +1013,7 @@ public final class UtilDateTime {
     /**
      * Localized Timestamp to String conversion. To be used in tandem with stringToTimeStamp().
      */
-    private static String timeStampToString(Timestamp stamp, String dateTimeFormat, TimeZone tz, Locale locale) {
+    public static String timeStampToString(Timestamp stamp, String dateTimeFormat, TimeZone tz, Locale locale) {
         DateFormat dateFormat = toDateTimeFormat(dateTimeFormat, tz, locale);
         return dateFormat.format(stamp);
     }
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
index 4dcd946453..0ad8689d76 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilFormatOut.java
@@ -26,10 +26,11 @@ import java.util.Date;
 import java.util.Locale;
 import java.util.TimeZone;
 
-import com.ibm.icu.text.DecimalFormat;
 import org.apache.ofbiz.entity.Delegator;
 import org.apache.ofbiz.entity.util.EntityUtilProperties;
 
+import com.ibm.icu.text.DecimalFormat;
+
 /**
  * General output formatting functions - mainly for helping in JSPs
  */
@@ -116,14 +117,17 @@ public final class UtilFormatOut {
         return formatNumber(price, AMOUNT_FORMAT, null, null);
     }
 
-    /** Formats a double into a properly formatted currency string based on isoCode and Locale
-     * @param price The price double to be formatted
-     * @param isoCode the currency ISO code
-     * @param locale The Locale used to format the number
-     * @param maximumFractionDigits The maximum number of fraction digits used; if set to -1 than the default value for the locale is used
+    /**
+     * Formats a double into a properly formatted currency string based on isoCode and Locale
+     *
+     * @param price                 The price double to be formatted
+     * @param isoCode               the currency ISO code
+     * @param locale                The Locale used to format the number
+     * @param maximumFractionDigits The maximum number of fraction digits used; if
+     *                              set to -1 than the default value for the locale
      * @return A String with the formatted price
      */
-    private static String formatCurrency(double price, String isoCode, Locale locale, int maximumFractionDigits) {
+    public static String formatCurrency(double price, String isoCode, Locale locale, int maximumFractionDigits) {
         com.ibm.icu.text.NumberFormat nf = com.ibm.icu.text.NumberFormat.getCurrencyInstance(locale);
         if (isoCode != null && isoCode.length() > 1) {
             nf.setCurrency(com.ibm.icu.util.Currency.getInstance(isoCode));
@@ -138,11 +142,15 @@ public final class UtilFormatOut {
         return nf.format(price);
     }
 
-    /** Formats a BigDecimal into a properly formatted currency string based on isoCode and Locale
-     * @param price The price BigDecimal to be formatted
-     * @param isoCode the currency ISO code
-     * @param locale The Locale used to format the number
-     * @param maximumFractionDigits The maximum number of fraction digits used; if set to -1 than the default value for the locale is used
+    /**
+     * Formats a double into a properly formatted currency string based on isoCode and Locale
+     *
+     * @param price                 The price BigDecimal to be formatted
+     * @param isoCode               the currency ISO code
+     * @param locale                The Locale used to format the number
+     * @param maximumFractionDigits The maximum number of fraction digits used; if
+     *                              set to -1 than the default value for the locale
+     *                              is used
      * @return A String with the formatted price
      */
     public static String formatCurrency(BigDecimal price, String isoCode, Locale locale, int maximumFractionDigits) {
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
index 55358a970d..fb8d1b5663 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilHttp.java
@@ -516,7 +516,7 @@ public final class UtilHttp {
      * Create a map from a HttpRequest (attributes) object
      * @return The resulting Map
      */
-    private static Map<String, Object> getAttributeMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
+    public static Map<String, Object> getAttributeMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
         Map<String, Object> attributeMap = new HashMap<>();
 
         // look at all request attributes
@@ -551,7 +551,7 @@ public final class UtilHttp {
      * Create a map from a HttpSession object
      * @return The resulting Map
      */
-    private static Map<String, Object> getSessionMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
+    public static Map<String, Object> getSessionMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
         Map<String, Object> sessionMap = new HashMap<>();
         HttpSession session = request.getSession();
 
@@ -587,7 +587,7 @@ public final class UtilHttp {
      * Create a map from a ServletContext object
      * @return The resulting Map
      */
-    private static Map<String, Object> getServletContextMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
+    public static Map<String, Object> getServletContextMap(HttpServletRequest request, Set<? extends String> namesToSkip) {
         Map<String, Object> servletCtxMap = new HashMap<>();
 
         // look at all servlet context attributes
@@ -894,7 +894,7 @@ public final class UtilHttp {
         setTimeZone(request.getSession(), UtilDateTime.toTimeZone(tzId));
     }
 
-    private static void setTimeZone(HttpSession session, TimeZone timeZone) {
+    public static void setTimeZone(HttpSession session, TimeZone timeZone) {
         session.setAttribute(SESSION_KEY_TIMEZONE, timeZone);
     }
 
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
index d2923ca628..878f222f6c 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
@@ -436,7 +436,7 @@ public final class UtilMisc {
      * @param obj Object to convert
      * @return Double
      */
-    private static Double toDoubleObject(Object obj) {
+    public static Double toDoubleObject(Object obj) {
         if (obj == null) {
             return null;
         }
@@ -510,7 +510,7 @@ public final class UtilMisc {
      * @param obj Object to convert
      * @return Long
      */
-    private static Long toLongObject(Object obj) {
+    public static Long toLongObject(Object obj) {
         if (obj == null) {
             return null;
         }
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java
index f244e935cd..0eac51b432 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilNumber.java
@@ -23,9 +23,9 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.HashMap;
 import java.util.Locale;
+import java.util.Map;
 
 import com.ibm.icu.text.RuleBasedNumberFormat;
-import java.util.Map;
 
 public final class UtilNumber {
 
@@ -270,7 +270,7 @@ public final class UtilNumber {
      * @param   value - The name of the mode (e.g., "ROUND_HALF_UP")
      * @return  RoundingMode - The rounding mode value of the mode (e.g, RoundingMode.HALF_UP) or null if the input was bad.
      */
-    private static RoundingMode roundingModeFromString(String value) {
+    public static RoundingMode roundingModeFromString(String value) {
         if (value == null) {
             return null;
         }
@@ -324,7 +324,7 @@ public final class UtilNumber {
      * @param   locale - the Locale
      * @return  formatted string or an empty string if there was an error
      */
-    private static String formatRuleBasedAmount(double amount, String ruleSet, String rule, Locale locale) {
+    public static String formatRuleBasedAmount(double amount, String ruleSet, String rule, Locale locale) {
         RuleBasedNumberFormat formatter = new RuleBasedNumberFormat(ruleSet, locale);
         String result = "";
         try {
@@ -366,7 +366,7 @@ public final class UtilNumber {
      * @param roundingMode  the RoundingMode rounding mode to apply
      * @return          The formatted string or "" if there were errors.
      */
-    private static String toPercentString(Number number, int scale, RoundingMode roundingMode) {
+    public static String toPercentString(Number number, int scale, RoundingMode roundingMode) {
         // convert to BigDecimal
         if (!(number instanceof BigDecimal)) {
             number = new BigDecimal(number.doubleValue());
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java
index fba0827677..7b02183c63 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilTimer.java
@@ -65,7 +65,7 @@ public class UtilTimer {
     /**
      * Start timer.
      */
-    private void startTimer() {
+    public void startTimer() {
         startTime = System.currentTimeMillis();
         realStartTime = startTime;
         this.lastMessageTime = startTime;
@@ -141,21 +141,21 @@ public class UtilTimer {
     /** Returns the number of seconds since the timer started
      * @return The number of seconds since the timer started
      */
-    private double secondsSinceStart() {
+    public double secondsSinceStart() {
         return (timeSinceStart()) / 1000.0;
     }
 
     /** Returns the number of seconds since the last time timerString was called
      * @return The number of seconds since the last time timerString was called
      */
-    private double secondsSinceLast() {
+    public double secondsSinceLast() {
         return (timeSinceLast()) / 1000.0;
     }
 
     /** Returns the number of milliseconds since the timer started
      * @return The number of milliseconds since the timer started
      */
-    private long timeSinceStart() {
+    public long timeSinceStart() {
         long currentTime = System.currentTimeMillis();
 
         return currentTime - startTime;
@@ -227,11 +227,11 @@ public class UtilTimer {
 
     // static logging timer - be sure to close the timer when finished!
 
-    private static UtilTimer getTimer(String timerName) {
+    public static UtilTimer getTimer(String timerName) {
         return getTimer(timerName, true);
     }
 
-    private static UtilTimer getTimer(String timerName, boolean log) {
+    public static UtilTimer getTimer(String timerName, boolean log) {
         UtilTimer timer = STATIC_TIMERS.get(timerName);
         if (timer == null) {
             timer = new UtilTimer(timerName, false);
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
index fd894e3ffa..e1655f83b8 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilURL.java
@@ -148,7 +148,7 @@ public final class UtilURL {
         return url;
     }
 
-    private static URL fromOfbizHomePath(String filename) {
+    public static URL fromOfbizHomePath(String filename) {
         String ofbizHome = System.getProperty("ofbiz.home");
         if (ofbizHome == null) {
             Debug.logWarning("No ofbiz.home property set in environment", MODULE);
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
index be8b3e832f..1d0215ddf0 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilValidate.java
@@ -270,7 +270,7 @@ public final class UtilValidate {
      *  first character is allowed to be + or - as well.
      *  Does not accept floating point, exponential notation, etc.
      */
-    private static boolean isSignedInteger(String s) {
+    public static boolean isSignedInteger(String s) {
         if (isEmpty(s)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -302,7 +302,7 @@ public final class UtilValidate {
      * Returns true if string s is an integer &gt; 0.
      * NOTE: using the Java Long object for greatest precision
      */
-    private static boolean isPositiveInteger(String s) {
+    public static boolean isPositiveInteger(String s) {
         if (isEmpty(s)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -318,7 +318,7 @@ public final class UtilValidate {
     /**
      * Returns true if string s is an integer &gt;= 0
      */
-    private static boolean isNonnegativeInteger(String s) {
+    public static boolean isNonnegativeInteger(String s) {
         if (isEmpty(s)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -662,7 +662,7 @@ public final class UtilValidate {
      *  For Year 2000 compliance, you are advised
      *  to use 4-digit year numbers everywhere.
      */
-    private static boolean isYear(String s) {
+    public static boolean isYear(String s) {
         if (isEmpty(s)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -691,7 +691,7 @@ public final class UtilValidate {
     }
 
     /** isMonth returns true if string s is a valid month number between 1 and 12. */
-    private static boolean isMonth(String s) {
+    public static boolean isMonth(String s) {
         if (isEmpty(s)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -699,7 +699,7 @@ public final class UtilValidate {
     }
 
     /** isDay returns true if string s is a valid day number between 1 and 31. */
-    private static boolean isDay(String s) {
+    public static boolean isDay(String s) {
         if (isEmpty(s)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -707,14 +707,14 @@ public final class UtilValidate {
     }
 
     /** Given integer argument year, returns number of days in February of that year. */
-    private static int daysInFebruary(int year) {
+    public static int daysInFebruary(int year) {
         // February has 29 days in any year evenly divisible by four,
         // EXCEPT for centurial years which are not also divisible by 400.
         return (((year % 4 == 0) && ((!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28);
     }
 
     /** isHour returns true if string s is a valid number between 0 and 23. */
-    private static boolean isHour(String s) {
+    public static boolean isHour(String s) {
         if (isEmpty(s)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -888,7 +888,7 @@ public final class UtilValidate {
         return false;
     }
     /** isTime returns true if string arguments hour, minute, and second form a valid time. */
-    private static boolean isTime(String hour, String minute, String second) {
+    public static boolean isTime(String hour, String minute, String second) {
         // catch invalid years(not 2- or 4-digit) and invalid months and days.
         return isHour(hour) && isMinute(minute) && isSecond(second);
     }
@@ -924,7 +924,7 @@ public final class UtilValidate {
      * @param stPassed a string representing a valuelink gift card
      * @return true, if the number passed simple checks
      */
-    private static boolean isValueLinkCard(String stPassed) {
+    public static boolean isValueLinkCard(String stPassed) {
         if (isEmpty(stPassed)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -936,7 +936,7 @@ public final class UtilValidate {
      * @param stPassed a string representing a gift card
      * @return tru, if the number passed simple checks
      */
-    private static boolean isOFBGiftCard(String stPassed) {
+    public static boolean isOFBGiftCard(String stPassed) {
         if (isEmpty(stPassed)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -986,7 +986,7 @@ public final class UtilValidate {
      * @param stPassed a string representing a credit card number
      * @return true, if the credit card number passes the Luhn Mod-10 test, false otherwise
      */
-    private static boolean isCreditCard(String stPassed) {
+    public static boolean isCreditCard(String stPassed) {
         if (isEmpty(stPassed)) {
             return DEFAULT_EMPTY_OK;
         }
@@ -1000,7 +1000,7 @@ public final class UtilValidate {
      * @param cc a string representing a credit card number; Sample number: 4111 1111 1111 1111(16 digits)
      * @return true, if the credit card number is a valid VISA number, false otherwise
      */
-    private static boolean isVisa(String cc) {
+    public static boolean isVisa(String cc) {
         if (((cc.length() == 16) || (cc.length() == 13)) && ("4".equals(cc.substring(0, 1)))) {
             return isCreditCard(cc);
         }
@@ -1012,7 +1012,7 @@ public final class UtilValidate {
      *           through 2720. All have 16 digits; Sample number: 5500 0000 0000 0004(16 digits)
      * @return true, if the credit card number is a valid MasterCard  number, false otherwise
      */
-    private static boolean isMasterCard(String cc) {
+    public static boolean isMasterCard(String cc) {
         int first2digs = Integer.parseInt(cc.substring(0, 2));
         int first4digs = Integer.parseInt(cc.substring(0, 4));
 
@@ -1027,7 +1027,7 @@ public final class UtilValidate {
      *   @param    cc - a string representing a credit card number; Sample number: 340000000000009(15 digits)
      *   @return  true, if the credit card number is a valid American Express number, false otherwise
      */
-    private static boolean isAmericanExpress(String cc) {
+    public static boolean isAmericanExpress(String cc) {
         int firstdig = Integer.parseInt(cc.substring(0, 1));
         int seconddig = Integer.parseInt(cc.substring(1, 2));
 
@@ -1042,7 +1042,7 @@ public final class UtilValidate {
      *   @param    cc - a string representing a credit card number; Sample number: 30000000000004(14 digits)
      *   @return  true, if the credit card number is a valid Diner's Club number, false otherwise
      */
-    private static boolean isDinersClub(String cc) {
+    public static boolean isDinersClub(String cc) {
         int firstdig = Integer.parseInt(cc.substring(0, 1));
         int seconddig = Integer.parseInt(cc.substring(1, 2));
 
@@ -1056,7 +1056,7 @@ public final class UtilValidate {
      *   @param    cc - a string representing a credit card number; Sample number: 30000000000004(14 digits)
      *   @return  true, if the credit card number is a valid Carte Blanche number, false otherwise
      */
-    private static boolean isCarteBlanche(String cc) {
+    public static boolean isCarteBlanche(String cc) {
         return isDinersClub(cc);
     }
 
@@ -1065,7 +1065,7 @@ public final class UtilValidate {
      *                Sample number: 6011000000000004(16 digits)
      *   @return  true, if the credit card number is a valid Discover card number, false otherwise
      */
-    private static boolean isDiscover(String cc) {
+    public static boolean isDiscover(String cc) {
         String first4digs = cc.substring(0, 4);
         String first2digs = cc.substring(0, 2);
 
@@ -1079,7 +1079,7 @@ public final class UtilValidate {
      *   @param    cc - a string representing a credit card number; Sample number: 201400000000009(15 digits)
      *   @return  true, if the credit card number is a valid enRoute card number, false, otherwise
      */
-    private static boolean isEnRoute(String cc) {
+    public static boolean isEnRoute(String cc) {
         String first4digs = cc.substring(0, 4);
 
         if ((cc.length() == 15) && ("2014".equals(first4digs) || "2149".equals(first4digs))) {
@@ -1093,7 +1093,7 @@ public final class UtilValidate {
      *                 with 35 have 16 digits;Sample number: 3088000000000009(16 digits)
      *   @return  true, if the credit card number is a valid JCB card number, false otherwise
      */
-    private static boolean isJCB(String cc) {
+    public static boolean isJCB(String cc) {
         String first4digs = cc.substring(0, 4);
         String first2digs = cc.substring(0, 2);
 
@@ -1108,7 +1108,7 @@ public final class UtilValidate {
      *   @param     cc - a string representing a credit card number; Sample number: 6331100000000096(16 digits)
      *   @return  true, if the credit card number is a valid Switch card number, false otherwise
      */
-    private static boolean isSwitch(String cc) {
+    public static boolean isSwitch(String cc) {
         String first4digs = cc.substring(0, 4);
         String first6digs = cc.substring(0, 6);
 
@@ -1130,7 +1130,7 @@ public final class UtilValidate {
      *   @param     cc - a string representing a credit card number; Sample number: 6331100000000096 (16 digits)
      *   @return  true, if the credit card number is a valid Solo card number, false otherwise
      */
-    private static boolean isSolo(String cc) {
+    public static boolean isSolo(String cc) {
         String first4digs = cc.substring(0, 4);
         String first2digs = cc.substring(0, 2);
         if (((cc.length() == 16) || (cc.length() == 18) || (cc.length() == 19)) && ("63".equals(first2digs) || "6767".equals(first4digs))) {
@@ -1143,7 +1143,7 @@ public final class UtilValidate {
      *   @param    cc - a string representing a credit card number; Sample number: 4175000000000001(16 digits)
      *   @return  true, if the credit card number is a valid Visa Electron card number, false otherwise
      */
-    private static boolean isVisaElectron(String cc) {
+    public static boolean isVisaElectron(String cc) {
         String first6digs = cc.substring(0, 6);
         String first4digs = cc.substring(0, 4);
 
@@ -1311,7 +1311,7 @@ public final class UtilValidate {
         return isValidPhoneNumber(phoneNumber, geoId, delegator);
     }
 
-    private static boolean isValidPhoneNumber(String phoneNumber, String geoId, Delegator delegator) {
+    public static boolean isValidPhoneNumber(String phoneNumber, String geoId, Delegator delegator) {
         boolean isValid = false;
         try {
             GenericValue geo = EntityQuery.use(delegator).from("Geo").where("geoId", geoId).cache().queryOne();
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java b/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java
index 2d691c9652..7b82a4737e 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/geo/GeoWorker.java
@@ -21,11 +21,9 @@ package org.apache.ofbiz.common.geo;
 import java.util.LinkedHashMap;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.Map;
 import java.util.Locale;
+import java.util.Map;
 
-import com.ibm.icu.util.LocaleData;
-import com.ibm.icu.util.ULocale;
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.UtilMisc;
 import org.apache.ofbiz.base.util.UtilValidate;
@@ -35,6 +33,9 @@ import org.apache.ofbiz.entity.GenericValue;
 import org.apache.ofbiz.entity.util.EntityQuery;
 import org.apache.ofbiz.entity.util.EntityUtil;
 
+import com.ibm.icu.util.LocaleData;
+import com.ibm.icu.util.ULocale;
+
 /**
  * Worker methods for Geos
  */
@@ -54,7 +55,7 @@ public final class GeoWorker {
         return expandGeoGroup(geo);
     }
 
-    private static List<GenericValue> expandGeoGroup(GenericValue geo) {
+    public static List<GenericValue> expandGeoGroup(GenericValue geo) {
         if (geo == null) {
             return new LinkedList<>();
         }
@@ -117,7 +118,7 @@ public final class GeoWorker {
         return containsGeo(geoList, geo);
     }
 
-    private static boolean containsGeo(List<GenericValue> geoList, GenericValue geo) {
+    public static boolean containsGeo(List<GenericValue> geoList, GenericValue geo) {
         if (geoList == null || geo == null) {
             return false;
         }