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 abb4ead2f6 Improved: Reducing scope of variables in org.apache.ofbiz.base package (OFBIZ-10478) abb4ead2f6 is described below commit abb4ead2f64187e08bf7dccd93c2ee3ba62ba15b Author: Jacques Le Roux <jacques.le.r...@les7arts.com> AuthorDate: Tue Sep 27 12:07:04 2022 +0200 Improved: Reducing scope of variables in org.apache.ofbiz.base package (OFBIZ-10478) jleroux: maybe because not all was applied or code changed, (or?) I had to manually change - public static boolean isFileResourceLoader + static boolean isFileResourceLoader That was in the patch and not applied revert - public String getMountPoint() { + String getMountPoint() { - public synchronized boolean getAppBarDisplay() { + synchronized boolean getAppBarDisplay() { Thanks: Pradhan Yash Sharma for the patch --- .../ofbiz/base/component/ComponentConfig.java | 22 ++++++------ .../ofbiz/base/component/ComponentException.java | 8 ++--- .../base/component/ComponentResourceHandler.java | 2 +- .../ofbiz/base/concurrent/ExecutionPool.java | 4 +-- .../apache/ofbiz/base/config/JNDIConfigUtil.java | 2 +- .../apache/ofbiz/base/config/ResourceLoader.java | 4 +-- .../conversion/AbstractLocalizedConverter.java | 2 +- .../apache/ofbiz/base/conversion/Converters.java | 8 ++--- .../base/conversion/GenericSingletonToList.java | 2 +- .../base/conversion/GenericSingletonToSet.java | 2 +- .../ofbiz/base/conversion/MiscConverters.java | 2 +- .../ofbiz/base/conversion/NumberConverters.java | 18 +++++----- .../apache/ofbiz/base/crypto/BlowFishCrypt.java | 10 +++--- .../org/apache/ofbiz/base/crypto/HashCrypt.java | 4 +-- .../ofbiz/base/location/FlexibleLocation.java | 2 +- .../java/org/apache/ofbiz/base/util/Debug.java | 2 +- .../java/org/apache/ofbiz/base/util/FileUtil.java | 12 +++---- .../apache/ofbiz/base/util/GeneralException.java | 2 +- .../org/apache/ofbiz/base/util/GroovyUtil.java | 2 +- .../org/apache/ofbiz/base/util/HttpClient.java | 2 +- .../apache/ofbiz/base/util/IndentingWriter.java | 2 +- .../org/apache/ofbiz/base/util/KeyStoreUtil.java | 4 +-- .../org/apache/ofbiz/base/util/MessageString.java | 4 +-- .../apache/ofbiz/base/util/MultiTrustManager.java | 4 +-- .../org/apache/ofbiz/base/util/ObjectType.java | 8 ++--- .../java/org/apache/ofbiz/base/util/SSLUtil.java | 10 +++--- .../org/apache/ofbiz/base/util/ScriptUtil.java | 8 ++--- .../org/apache/ofbiz/base/util/StringUtil.java | 2 +- .../org/apache/ofbiz/base/util/URLConnector.java | 4 +-- .../java/org/apache/ofbiz/base/util/UtilCodec.java | 4 +-- .../org/apache/ofbiz/base/util/UtilDateTime.java | 34 +++++++++--------- .../org/apache/ofbiz/base/util/UtilFormatOut.java | 4 +-- .../java/org/apache/ofbiz/base/util/UtilHttp.java | 14 ++++---- .../java/org/apache/ofbiz/base/util/UtilMisc.java | 4 +-- .../org/apache/ofbiz/base/util/UtilNumber.java | 6 ++-- .../java/org/apache/ofbiz/base/util/UtilPlist.java | 10 +++--- .../org/apache/ofbiz/base/util/UtilProperties.java | 4 +-- .../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 | 42 +++++++++++----------- .../java/org/apache/ofbiz/base/util/UtilXml.java | 4 +-- .../apache/ofbiz/base/util/cache/CacheLine.java | 2 +- .../ofbiz/base/util/cache/CacheSoftReference.java | 2 +- .../ofbiz/base/util/cache/HardRefCacheLine.java | 2 +- .../ofbiz/base/util/cache/SoftRefCacheLine.java | 2 +- .../apache/ofbiz/base/util/cache/UtilCache.java | 24 ++++++------- .../ofbiz/base/util/collections/GenericMap.java | 4 +-- .../util/collections/GenericMapCollection.java | 4 +-- .../base/util/collections/GenericMapEntrySet.java | 2 +- .../base/util/collections/GenericMapKeySet.java | 2 +- .../ofbiz/base/util/collections/GenericMapSet.java | 2 +- .../base/util/collections/GenericMapValues.java | 2 +- .../apache/ofbiz/base/util/collections/LRUMap.java | 6 ++-- .../ofbiz/base/util/collections/MapContext.java | 2 +- .../ofbiz/base/util/string/UelFunctions.java | 8 ++--- .../org/apache/ofbiz/base/util/string/UelUtil.java | 4 +-- 56 files changed, 183 insertions(+), 183 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java index f6cbc4c32c..3dcb13bdbd 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java @@ -206,7 +206,7 @@ public final class ComponentConfig { return componentConfig; } - public static String getFullLocation(String componentName, String resourceLoaderName, String location) throws ComponentException { + static String getFullLocation(String componentName, String resourceLoaderName, String location) throws ComponentException { ComponentConfig cc = getComponentConfig(componentName, null); return cc.getFullLocation(resourceLoaderName, location); } @@ -231,7 +231,7 @@ public final class ComponentConfig { return cc.rootLocation().toString(); } - public static InputStream getStream(String componentName, String resourceLoaderName, String location) throws ComponentException { + static InputStream getStream(String componentName, String resourceLoaderName, String location) throws ComponentException { ComponentConfig cc = getComponentConfig(componentName); return cc.getStream(resourceLoaderName, location); } @@ -474,11 +474,11 @@ public final class ComponentConfig { return this.configurations; } - public List<EntityResourceInfo> getEntityResourceInfos() { + private List<EntityResourceInfo> getEntityResourceInfos() { return this.entityResourceInfos; } - public String getFullLocation(String resourceLoaderName, String location) throws ComponentException { + private String getFullLocation(String resourceLoaderName, String location) throws ComponentException { ResourceLoaderInfo resourceLoaderInfo = resourceLoaderInfos.get(resourceLoaderName); if (resourceLoaderInfo == null) { throw new ComponentException("Could not find resource-loader named: " + resourceLoaderName); @@ -519,7 +519,7 @@ public final class ComponentConfig { return this.dependsOnInfos; } - public List<KeystoreInfo> getKeystoreInfos() { + private List<KeystoreInfo> getKeystoreInfos() { return this.keystoreInfos; } @@ -535,11 +535,11 @@ public final class ComponentConfig { return rootLocation; } - public List<ServiceResourceInfo> getServiceResourceInfos() { + private List<ServiceResourceInfo> getServiceResourceInfos() { return this.serviceResourceInfos; } - public InputStream getStream(String resourceLoaderName, String location) throws ComponentException { + private InputStream getStream(String resourceLoaderName, String location) throws ComponentException { URL url = getURL(resourceLoaderName, location); try { return url.openStream(); @@ -548,7 +548,7 @@ public final class ComponentConfig { } } - public List<TestSuiteInfo> getTestSuiteInfos() { + private List<TestSuiteInfo> getTestSuiteInfos() { return this.testSuiteInfos; } @@ -596,7 +596,7 @@ public final class ComponentConfig { return isFileResourceLoader(resourceInfo.loader); } - public boolean isFileResourceLoader(String resourceLoaderName) throws ComponentException { + boolean isFileResourceLoader(String resourceLoaderName) throws ComponentException { ResourceLoaderInfo resourceLoaderInfo = resourceLoaderInfos.get(resourceLoaderName); if (resourceLoaderInfo == null) { throw new ComponentException("Could not find resource-loader named: " + resourceLoaderName); @@ -818,7 +818,7 @@ public final class ComponentConfig { private final String loader; private final String location; - protected ResourceInfo(ComponentConfig componentConfig, Element element) { + ResourceInfo(ComponentConfig componentConfig, Element element) { this.componentConfig = componentConfig; this.loader = element.getAttribute("loader"); this.location = element.getAttribute("location"); @@ -885,7 +885,7 @@ public final class ComponentConfig { * @see <code>ofbiz-component.xsd</code> */ public static final class TestSuiteInfo extends ResourceInfo { - public TestSuiteInfo(ComponentConfig componentConfig, Element element) { + TestSuiteInfo(ComponentConfig componentConfig, Element element) { super(componentConfig, element); } } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentException.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentException.java index 5e1bdb4f6c..5ef6eb50b4 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentException.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentException.java @@ -27,19 +27,19 @@ import org.apache.ofbiz.base.config.GenericConfigException; @SuppressWarnings("serial") public class ComponentException extends GenericConfigException { - public ComponentException() { + ComponentException() { super(); } - public ComponentException(String str) { + ComponentException(String str) { super(str); } - public ComponentException(Throwable nested) { + ComponentException(Throwable nested) { super(nested); } - public ComponentException(String str, Throwable nested) { + ComponentException(String str, Throwable nested) { super(str, nested); } } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java index 713a9f2813..c82a74f8a6 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentResourceHandler.java @@ -50,7 +50,7 @@ public class ComponentResourceHandler implements ResourceHandler { this.location = element.getAttribute("location"); } - public ComponentResourceHandler(String componentName, String loaderName, String location) { + ComponentResourceHandler(String componentName, String loaderName, String location) { this.componentName = componentName; this.loaderName = loaderName; this.location = location; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java b/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java index 388c82bac5..eac1d4e825 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/concurrent/ExecutionPool.java @@ -52,7 +52,7 @@ public final class ExecutionPool { private final String namePrefix; private volatile int count = 1; - protected ExecutionPoolThreadFactory(ThreadGroup group, String namePrefix) { + ExecutionPoolThreadFactory(ThreadGroup group, String namePrefix) { this.group = group; this.namePrefix = namePrefix; } @@ -186,7 +186,7 @@ public final class ExecutionPool { * @param other used to calculate the difference * @return the time difference of the two instance's expireTimeNanos */ - public long timeDiff(Pulse other) { + long timeDiff(Pulse other) { return expireTimeNanos - other.expireTimeNanos; } } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java index efef439cb1..e6eaa14c7f 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/config/JNDIConfigUtil.java @@ -91,7 +91,7 @@ public final class JNDIConfigUtil { return securityCredentials; } - public JndiServerInfo(Element element) { + JndiServerInfo(Element element) { this.name = element.getAttribute("name"); this.contextProviderUrl = element.getAttribute("context-provider-url"); this.initialContextFactory = element.getAttribute("initial-context-factory"); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java b/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java index 07c6397c83..b6bf546411 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/config/ResourceLoader.java @@ -38,7 +38,7 @@ public abstract class ResourceLoader { // This cache is temporary - we will use it until the framework has been refactored to eliminate DOM tree caching, then it can be removed. private static final UtilCache<String, Document> DOM_CACHE = UtilCache.createUtilCache("resource.DomTrees", 0, 0); - public static InputStream loadResource(String xmlFilename, String location, String loaderName) throws GenericConfigException { + static InputStream loadResource(String xmlFilename, String location, String loaderName) throws GenericConfigException { ResourceLoader loader = getLoader(xmlFilename, loaderName); if (loader == null) { throw new IllegalArgumentException("ResourceLoader not found with name [" + loaderName + "] in " + xmlFilename); @@ -179,7 +179,7 @@ public abstract class ResourceLoader { * @param location * @return the built-up full location */ - public String fullLocation(String location) { + String fullLocation(String location) { StringBuilder buf = new StringBuilder(); if (!envName.isEmpty()) { String propValue = System.getProperty(envName); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractLocalizedConverter.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractLocalizedConverter.java index 124c932477..f49c336555 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractLocalizedConverter.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/AbstractLocalizedConverter.java @@ -26,7 +26,7 @@ import java.util.TimeZone; * and <code>getTargetClass</code> methods. */ public abstract class AbstractLocalizedConverter<S, T> extends AbstractConverter<S, T> implements LocalizedConverter<S, T> { - protected AbstractLocalizedConverter(Class<? super S> sourceClass, Class<? super T> targetClass) { + AbstractLocalizedConverter(Class<? super S> sourceClass, Class<? super T> targetClass) { super(sourceClass, targetClass); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java index 3a14a2aedd..26014c5330 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/Converters.java @@ -161,7 +161,7 @@ public final class Converters { * @param <T> The target object type * @param creator The <code>ConverterCreater</code> instance to register */ - public static <S, T> void registerCreator(ConverterCreator creator) { + static <S, T> void registerCreator(ConverterCreator creator) { synchronized (CREATORS) { CREATORS.add(creator); } @@ -178,7 +178,7 @@ public final class Converters { registerConverter(converter, converter.getSourceClass(), converter.getTargetClass()); } - public static <S, T> void registerConverter(Converter<S, T> converter, Class<?> sourceClass, Class<?> targetClass) { + private static <S, T> void registerConverter(Converter<S, T> converter, Class<?> sourceClass, Class<?> targetClass) { StringBuilder sb = new StringBuilder(); if (sourceClass != null) { sb.append(sourceClass.getName()); @@ -196,7 +196,7 @@ public final class Converters { } protected static class PassThruConverterCreator implements ConverterCreator { - protected PassThruConverterCreator() { + PassThruConverterCreator() { } @Override @@ -216,7 +216,7 @@ public final class Converters { private final Class<S> sourceClass; private final Class<T> targetClass; - public PassThruConverter(Class<S> sourceClass, Class<T> targetClass) { + PassThruConverter(Class<S> sourceClass, Class<T> targetClass) { this.sourceClass = sourceClass; this.targetClass = targetClass; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToList.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToList.java index b5a829659d..12f5fc014a 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToList.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToList.java @@ -22,7 +22,7 @@ import java.util.LinkedList; import java.util.List; public class GenericSingletonToList<T> extends AbstractConverter<T, List<T>> { - public GenericSingletonToList(Class<T> sourceClass) { + GenericSingletonToList(Class<T> sourceClass) { super(sourceClass, List.class); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToSet.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToSet.java index fe592ec9eb..faef2ba277 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToSet.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/GenericSingletonToSet.java @@ -22,7 +22,7 @@ import java.util.HashSet; import java.util.Set; public class GenericSingletonToSet<T> extends AbstractConverter<T, Set<T>> { - public GenericSingletonToSet(Class<T> sourceClass) { + GenericSingletonToSet(Class<T> sourceClass) { super(sourceClass, Set.class); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java index ea164fb874..0c4f8d85c0 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/MiscConverters.java @@ -36,7 +36,7 @@ import org.apache.ofbiz.base.util.UtilMisc; /** Miscellaneous Converter classes. */ public class MiscConverters implements ConverterLoader { - public static final int CHAR_BUFFER_SIZE = 4096; + private static final int CHAR_BUFFER_SIZE = 4096; public static class BlobToBlob extends AbstractConverter<Blob, Blob> { public BlobToBlob() { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java index fce8f9c3ef..ad6a5032d3 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/conversion/NumberConverters.java @@ -31,7 +31,7 @@ import org.apache.ofbiz.base.util.StringUtil; /** Number Converter classes. */ public class NumberConverters implements ConverterLoader { - protected static Number fromString(String str, Locale locale) throws ConversionException { + private static Number fromString(String str, Locale locale) throws ConversionException { NumberFormat nf = NumberFormat.getNumberInstance(locale); if (nf instanceof DecimalFormat) { // CHECKSTYLE_OFF: ALMOST_ALL @@ -46,7 +46,7 @@ public class NumberConverters implements ConverterLoader { } public abstract static class AbstractStringToNumberConverter<N extends Number> extends AbstractNumberConverter<String, N> { - public AbstractStringToNumberConverter(Class<N> targetClass) { + AbstractStringToNumberConverter(Class<N> targetClass) { super(String.class, targetClass); } @@ -63,7 +63,7 @@ public class NumberConverters implements ConverterLoader { } public abstract static class AbstractNumberConverter<S, T> extends AbstractLocalizedConverter<S, T> { - protected AbstractNumberConverter(Class<S> sourceClass, Class<T> targetClass) { + AbstractNumberConverter(Class<S> sourceClass, Class<T> targetClass) { super(sourceClass, targetClass); } @@ -74,7 +74,7 @@ public class NumberConverters implements ConverterLoader { } public abstract static class AbstractNumberToStringConverter<N extends Number> extends AbstractNumberConverter<N, String> { - public AbstractNumberToStringConverter(Class<N> sourceClass) { + AbstractNumberToStringConverter(Class<N> sourceClass) { super(sourceClass, String.class); } @@ -92,7 +92,7 @@ public class NumberConverters implements ConverterLoader { } public static class GenericNumberToDouble<N extends Number> extends AbstractConverter<N, Double> { - public GenericNumberToDouble(Class<N> sourceClass) { + GenericNumberToDouble(Class<N> sourceClass) { super(sourceClass, Double.class); } @@ -103,7 +103,7 @@ public class NumberConverters implements ConverterLoader { } public static class GenericNumberToFloat<N extends Number> extends AbstractConverter<N, Float> { - public GenericNumberToFloat(Class<N> sourceClass) { + GenericNumberToFloat(Class<N> sourceClass) { super(sourceClass, Float.class); } @@ -114,7 +114,7 @@ public class NumberConverters implements ConverterLoader { } public static class GenericNumberToInteger<N extends Number> extends AbstractConverter<N, Integer> { - public GenericNumberToInteger(Class<N> sourceClass) { + GenericNumberToInteger(Class<N> sourceClass) { super(sourceClass, Integer.class); } @@ -125,7 +125,7 @@ public class NumberConverters implements ConverterLoader { } public static class GenericNumberToLong<N extends Number> extends AbstractConverter<N, Long> { - public GenericNumberToLong(Class<N> sourceClass) { + GenericNumberToLong(Class<N> sourceClass) { super(sourceClass, Long.class); } @@ -136,7 +136,7 @@ public class NumberConverters implements ConverterLoader { } public static class GenericNumberToShort<N extends Number> extends AbstractConverter<N, Short> { - public GenericNumberToShort(Class<N> sourceClass) { + GenericNumberToShort(Class<N> sourceClass) { super(sourceClass, Short.class); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java b/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java index a9a408acac..9654e1055e 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/crypto/BlowFishCrypt.java @@ -53,7 +53,7 @@ public class BlowFishCrypt { * Creates a new BlowFishCrypt object. * @param key An encoded secret key */ - public BlowFishCrypt(byte[] key) { + private BlowFishCrypt(byte[] key) { try { secretKeySpec = new SecretKeySpec(key, "Blowfish"); } catch (IllegalArgumentException e) { @@ -88,7 +88,7 @@ public class BlowFishCrypt { * Decrypt the string with the secret key. * @param string The string to decrypt. */ - public byte[] decrypt(String string) { + private byte[] decrypt(String string) { return decrypt(string.getBytes(StandardCharsets.UTF_8)); } @@ -109,7 +109,7 @@ public class BlowFishCrypt { * Decrypt the byte array with the secret key. * @param bytes The array of bytes to decrypt. */ - public byte[] decrypt(byte[] bytes) { + private byte[] decrypt(byte[] bytes) { try { return crypt(bytes, Cipher.DECRYPT_MODE); } catch (Exception e) { @@ -128,7 +128,7 @@ public class BlowFishCrypt { return cipher.doFinal(bytes); } - public static byte[] generateKey() throws NoSuchAlgorithmException { + private static byte[] generateKey() throws NoSuchAlgorithmException { KeyGenerator keyGen = KeyGenerator.getInstance("Blowfish"); keyGen.init(448); @@ -138,7 +138,7 @@ public class BlowFishCrypt { return keyBytes; } - public static boolean testKey(byte[] key) { + private static boolean testKey(byte[] key) { String testString = "1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstufwxyz"; BlowFishCrypt c = new BlowFishCrypt(key); byte[] encryptedBytes = c.encrypt(testString); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java b/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java index 3d65622da4..ec1f76d076 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/crypto/HashCrypt.java @@ -55,9 +55,9 @@ public class HashCrypt { private static final SecureRandom SECURE_RANDOM = new SecureRandom(); - public static final String CRYPT_CHAR_SET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; + private static final String CRYPT_CHAR_SET = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; - public static MessageDigest getMessageDigest(String type) { + private static MessageDigest getMessageDigest(String type) { try { return MessageDigest.getInstance(type); } catch (NoSuchAlgorithmException e) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java b/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java index 0a3cb84d73..ccf766cf45 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/location/FlexibleLocation.java @@ -118,7 +118,7 @@ public final class FlexibleLocation { } } - public static String stripLocationType(String location) { + static String stripLocationType(String location) { if (UtilValidate.isEmpty(location)) { return ""; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java index b015aa7358..f3e1c0dd1e 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java @@ -77,7 +77,7 @@ public final class Debug { } } - public static Logger getLogger(String module) { + private static Logger getLogger(String module) { if (UtilValidate.isNotEmpty(module)) { return LogManager.getLogger(module); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java index a2b871e834..d838b9948e 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/FileUtil.java @@ -81,7 +81,7 @@ public final class FileUtil { * @param path The file path to convert. * @return The converted file path. */ - public static String localizePath(String path) { + private static String localizePath(String path) { String fileNameSeparator = ("\\".equals(File.separator) ? "\\" + File.separator : File.separator); return path.replaceAll("/+|\\\\+", fileNameSeparator); } @@ -90,7 +90,7 @@ public final class FileUtil { writeString(null, fileName, s); } - public static void writeString(String path, String name, String s) { + private static void writeString(String path, String name, String s) { try (Writer out = getBufferedWriter(path, name);) { out.write(s + System.getProperty("line.separator")); @@ -130,7 +130,7 @@ public final class FileUtil { } } - public static Writer getBufferedWriter(String path, String name) throws IOException { + private static Writer getBufferedWriter(String path, String name) throws IOException { String fileName = getPatchedFileName(path, name); if (UtilValidate.isEmpty(fileName)) { throw new IOException("Cannot obtain buffered writer for an empty filename!"); @@ -148,7 +148,7 @@ public final class FileUtil { return new BufferedOutputStream(new FileOutputStream(fileName)); } - public static String getPatchedFileName(String path, String fileName) throws IOException { + private static String getPatchedFileName(String path, String fileName) throws IOException { // make sure the export directory exists if (UtilValidate.isNotEmpty(path)) { path = path.replaceAll("\\\\", "/"); @@ -172,7 +172,7 @@ public final class FileUtil { return fileName; } - public static StringBuffer readTextFile(File file, boolean newline) throws FileNotFoundException, IOException { + private static StringBuffer readTextFile(File file, boolean newline) throws FileNotFoundException, IOException { if (!file.exists()) { throw new FileNotFoundException(); } @@ -210,7 +210,7 @@ public final class FileUtil { return readString; } - public static void searchFiles(List<File> fileList, File path, FilenameFilter filter, boolean includeSubfolders) throws IOException { + private static void searchFiles(List<File> fileList, File path, FilenameFilter filter, boolean includeSubfolders) throws IOException { // Get filtered files in the current path File[] files = path.listFiles(filter); if (files == null) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralException.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralException.java index 3c3e301164..28f30fa75f 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralException.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/GeneralException.java @@ -33,7 +33,7 @@ public class GeneralException extends Exception { return GeneralException.<T>checkException(t.getMessage(), t); } - public static <T> T checkException(String message, Throwable t) throws GeneralException { + private static <T> T checkException(String message, Throwable t) throws GeneralException { if (t instanceof Error) { throw (Error) t; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java index f6d6dc70e7..bda591f94f 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/GroovyUtil.java @@ -108,7 +108,7 @@ public final class GroovyUtil { * @param context A <code>Map</code> containing initial variables * @return A <code>Binding</code> instance */ - public static Binding getBinding(Map<String, Object> context, String expression) { + private static Binding getBinding(Map<String, Object> context, String expression) { Map<String, Object> vars = new HashMap<>(); if (context != null) { vars.putAll(context); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java index 1fac152f4a..2e316f9612 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/HttpClient.java @@ -358,7 +358,7 @@ public class HttpClient { * @return the string * @throws HttpClientException the http client exception */ - public String sendHttpRequest(String method) throws HttpClientException { + private String sendHttpRequest(String method) throws HttpClientException { InputStream in = sendHttpRequestStream(method); if (in == null) { return null; diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java index 4fbee032ad..0779b5b99f 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/IndentingWriter.java @@ -62,7 +62,7 @@ public class IndentingWriter extends FilterWriter { * Check after newline. * @throws IOException the io exception */ - protected void checkAfterNewline() throws IOException { + private void checkAfterNewline() throws IOException { if (lastWasNewline) { if (doSpace) { if (doNewline) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java index 796058dd46..2a1f7f5c93 100755 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/KeyStoreUtil.java @@ -94,7 +94,7 @@ public final class KeyStoreUtil { return ks; } - public static KeyStore getSystemTrustStore() throws IOException, GeneralSecurityException { + static KeyStore getSystemTrustStore() throws IOException, GeneralSecurityException { String javaHome = System.getProperty("java.home"); String fileName = System.getProperty("javax.net.ssl.trustStore"); String password = System.getProperty("javax.net.ssl.trustStorePassword"); @@ -133,7 +133,7 @@ public final class KeyStoreUtil { return getX500Map(cert.getSubjectX500Principal()); } - public static Map<String, String> getX500Map(Principal x500) { + static Map<String, String> getX500Map(Principal x500) { Map<String, String> x500Map = new HashMap<>(); String name = x500.getName().replaceAll("\\\\,", "&com;"); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/MessageString.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/MessageString.java index ebf1bb6353..2a08f6553e 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/MessageString.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/MessageString.java @@ -69,7 +69,7 @@ public class MessageString implements Serializable { } return getMessagesForField(fieldSet, convertToStrings, messageStringList); } - public static List<Object> getMessagesForField(Set<String> fieldNameSet, boolean convertToStrings, List<Object> messageStringList) { + private static List<Object> getMessagesForField(Set<String> fieldNameSet, boolean convertToStrings, List<Object> messageStringList) { if (messageStringList == null || UtilValidate.isEmpty(fieldNameSet)) { return Collections.emptyList(); } @@ -157,7 +157,7 @@ public class MessageString implements Serializable { * @param fieldNameSet the field name set * @return the boolean */ - public boolean isForField(Set<String> fieldNameSet) { + private boolean isForField(Set<String> fieldNameSet) { return fieldNameSet == null || fieldNameSet.contains(this.fieldName); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/MultiTrustManager.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/MultiTrustManager.java index eb12d9d148..26b53f42fb 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/MultiTrustManager.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/MultiTrustManager.java @@ -61,7 +61,7 @@ public class MultiTrustManager implements X509TrustManager { * Gets number of key stores. * @return the number of key stores */ - public int getNumberOfKeyStores() { + int getNumberOfKeyStores() { return keystores.size(); } @@ -127,7 +127,7 @@ public class MultiTrustManager implements X509TrustManager { * @param cert the cert * @return the boolean */ - protected boolean isTrusted(X509Certificate[] cert) { + private boolean isTrusted(X509Certificate[] cert) { if (cert != null) { X509Certificate[] issuers = this.getAcceptedIssuers(); for (X509Certificate issuer : issuers) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java index 442f648f06..6e98f5bd66 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/ObjectType.java @@ -45,8 +45,8 @@ public class ObjectType { public static final Object NULL = new NullObject(); - public static final String LANG_PACKAGE = "java.lang."; // We will test both the raw value and this + raw value - public static final String SQL_PACKAGE = "java.sql."; // We will test both the raw value and this + raw value + private static final String LANG_PACKAGE = "java.lang."; // We will test both the raw value and this + raw value + private static final String SQL_PACKAGE = "java.sql."; // We will test both the raw value and this + raw value private static final Map<String, String> CLASS_ALIAS = new HashMap<>(); private static final Map<String, Class<?>> PRIMITIVES = new HashMap<>(); @@ -223,7 +223,7 @@ public class ObjectType { return obj == null || infoClass.isInstance(obj); } - public static Class<?> loadInfoClass(String typeName, ClassLoader loader) { + private static Class<?> loadInfoClass(String typeName, ClassLoader loader) { try { return loadClass(typeName, loader); } catch (SecurityException se1) { @@ -648,7 +648,7 @@ public class ObjectType { @SuppressWarnings("serial") public static final class NullObject implements Serializable { - public NullObject() { } + NullObject() { } @Override public String toString() { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java index 9287fa7a2f..24b5c100e7 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/SSLUtil.java @@ -102,7 +102,7 @@ public final class SSLUtil { return HOSTCERT_MIN_CHECK; } - public static int getHostCertNormalCheck() { + static int getHostCertNormalCheck() { return HOSTCERT_NORMAL_CHECK; } @@ -129,7 +129,7 @@ public final class SSLUtil { return false; } - public static KeyManager[] getKeyManagers(String alias) throws IOException, GeneralSecurityException, GenericConfigException { + private static KeyManager[] getKeyManagers(String alias) throws IOException, GeneralSecurityException, GenericConfigException { List<KeyManager> keyMgrs = new LinkedList<>(); for (ComponentConfig.KeystoreInfo ksi: ComponentConfig.getAllKeystoreInfos()) { if (ksi.isCertStore()) { @@ -155,7 +155,7 @@ public final class SSLUtil { return getKeyManagers(null); } - public static TrustManager[] getTrustManagers() throws IOException, GeneralSecurityException, GenericConfigException { + private static TrustManager[] getTrustManagers() throws IOException, GeneralSecurityException, GenericConfigException { MultiTrustManager tm = new MultiTrustManager(); tm.add(KeyStoreUtil.getSystemTrustStore()); if (tm.getNumberOfKeyStores() < 1) { @@ -237,7 +237,7 @@ public final class SSLUtil { return context; } - public static SSLSocketFactory getSSLSocketFactory(String alias) throws IOException, GeneralSecurityException, GenericConfigException { + private static SSLSocketFactory getSSLSocketFactory(String alias) throws IOException, GeneralSecurityException, GenericConfigException { return getSSLSocketFactory(alias, false); } @@ -298,7 +298,7 @@ public final class SSLUtil { loadJsseProperties(false); } - public static synchronized void loadJsseProperties(boolean debug) { + static synchronized void loadJsseProperties(boolean debug) { if (!loadedProps) { String protocol = UtilProperties.getPropertyValue("jsse", "java.protocol.handler.pkgs", "NONE"); String proxyHost = UtilProperties.getPropertyValue("jsse", "https.proxyHost", "NONE"); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java index 0cf6519168..bab90b8f5b 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/ScriptUtil.java @@ -61,7 +61,7 @@ public final class ScriptUtil { private static final String MODULE = ScriptUtil.class.getName(); /** The screen widget context map bindings key. */ - public static final String WIDGET_CONTEXT_KEY = "widget"; + private static final String WIDGET_CONTEXT_KEY = "widget"; /** The service/servlet/request parameters map bindings key. */ public static final String PARAMETERS_KEY = "parameters"; /** The result map bindings key. */ @@ -113,7 +113,7 @@ public final class ScriptUtil { * @throws ScriptException * @throws IOException */ - public static CompiledScript compileScriptFile(String filePath) throws ScriptException, IOException { + private static CompiledScript compileScriptFile(String filePath) throws ScriptException, IOException { Assert.notNull("filePath", filePath); CompiledScript script = PARSED_SCRIPTS.get(filePath); if (script == null) { @@ -150,7 +150,7 @@ public final class ScriptUtil { * @throws IllegalArgumentException * @throws ScriptException */ - public static CompiledScript compileScriptString(String language, String script) throws ScriptException { + private static CompiledScript compileScriptString(String language, String script) throws ScriptException { Assert.notNull("language", language, "script", script); String cacheKey = language.concat("://").concat(script); CompiledScript compiledScript = PARSED_SCRIPTS.get(cacheKey); @@ -186,7 +186,7 @@ public final class ScriptUtil { * @param context * @return */ - public static ScriptContext createScriptContext(Map<String, Object> context) { + static ScriptContext createScriptContext(Map<String, Object> context) { Assert.notNull("context", context); Map<String, Object> localContext = new HashMap<>(context); localContext.put(WIDGET_CONTEXT_KEY, context); 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 15a6bc7fec..8aa11971d8 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 @@ -142,7 +142,7 @@ public final class StringUtil { * @param trim Trim whitespace off fields * @return a Map of name/value pairs */ - public static Map<String, String> strToMap(String str, String delim, boolean trim) { + private static Map<String, String> strToMap(String str, String delim, boolean trim) { return strToMap(str, delim, trim, null); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java index 803adf1651..7855c3b8b1 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/URLConnector.java @@ -45,7 +45,7 @@ public class URLConnector { private int hostCertLevel = 2; protected URLConnector() { } - protected URLConnector(URL url, String clientCertAlias, int hostCertLevel, boolean trustAnyCert) { + private URLConnector(URL url, String clientCertAlias, int hostCertLevel, boolean trustAnyCert) { this.clientCertAlias = clientCertAlias; this.url = url; this.trustAnyCert = trustAnyCert; @@ -111,7 +111,7 @@ public class URLConnector { return openConnection(url, 30000, clientCertAlias, SSLUtil.getHostCertNormalCheck()); } - public static URLConnection openUntrustedConnection(URL url, int timeout, String clientCertAlias, int hostCertLevel) throws IOException { + static URLConnection openUntrustedConnection(URL url, int timeout, String clientCertAlias, int hostCertLevel) throws IOException { URLConnector uc = new URLConnector(url, clientCertAlias, hostCertLevel, true); return uc.openConnection(timeout); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java index 015e1a149f..f229653b3f 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilCodec.java @@ -334,11 +334,11 @@ public class UtilCodec { return canonicalize(value, false, false); } - public static String canonicalize(String value, boolean strict) throws IntrusionException { + static String canonicalize(String value, boolean strict) throws IntrusionException { return canonicalize(value, strict, strict); } - public static String canonicalize(String input, boolean restrictMultiple, boolean restrictMixed) { + static String canonicalize(String input, boolean restrictMultiple, boolean restrictMixed) { if (input == null) { return null; } 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 335d2ce03c..7f4cb2fcf3 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 @@ -65,7 +65,7 @@ public final class UtilDateTime { private UtilDateTime() { } - public static double getInterval(Date from, Date thru) { + private static double getInterval(Date from, Date thru) { return thru != null ? thru.getTime() - from.getTime() : 0; } @@ -486,7 +486,7 @@ public final class UtilDateTime { * @param time The time String: either HH:MM or HH:MM:SS * @return A Date made from the date and time Strings */ - public static java.util.Date toDate(String date, String time) { + private static java.util.Date toDate(String date, String time) { if (date == null || time == null) { return null; } @@ -535,8 +535,8 @@ public final class UtilDateTime { * @param secondStr The second String * @return A Date made from separate Strings for month, day, year, hour, minute, and second. */ - public static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, - String minuteStr, String secondStr) { + static java.util.Date toDate(String monthStr, String dayStr, String yearStr, String hourStr, + String minuteStr, String secondStr) { int month; int day; @@ -569,7 +569,7 @@ public final class UtilDateTime { * @param second The second int * @return A Date made from separate ints for month, day, year, hour, minute, and second. */ - public static java.util.Date toDate(int month, int day, int year, int hour, int minute, int second) { + private static java.util.Date toDate(int month, int day, int year, int hour, int minute, int second) { Calendar calendar = Calendar.getInstance(); try { @@ -586,7 +586,7 @@ public final class UtilDateTime { * @param date The Date * @return A date String in the given format */ - public static String toDateString(java.util.Date date, String format) { + private static String toDateString(java.util.Date date, String format) { if (date == null) { return ""; } @@ -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 */ - public static String toTimeString(java.util.Date date) { + private 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 */ - public static String toTimeString(int hour, int minute, int second) { + private 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); } - public static Timestamp getWeekStart(Timestamp stamp, int daysLater, int weeksLater, TimeZone timeZone, Locale locale) { + private 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); } - public static Timestamp getMonthStart(Timestamp stamp, int daysLater, int monthsLater, TimeZone timeZone, Locale locale) { + private 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); } - public static Timestamp getYearStart(Timestamp stamp, int daysLater, int monthsLater, int yearsLater, TimeZone timeZone, Locale locale) { + private 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); } - public static int weekNumber(Timestamp stamp, TimeZone timeZone, Locale locale) { + private 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(). */ - public static Timestamp stringToTimeStamp(String dateTimeString, String dateTimeFormat, TimeZone tz, Locale locale) throws ParseException { + private 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(). */ - public static String timeStampToString(Timestamp stamp, String dateTimeFormat, TimeZone tz, Locale locale) { + private static String timeStampToString(Timestamp stamp, String dateTimeFormat, TimeZone tz, Locale locale) { DateFormat dateFormat = toDateTimeFormat(dateTimeFormat, tz, locale); return dateFormat.format(stamp); } @@ -1115,7 +1115,7 @@ public final class UtilDateTime { return cal.get(Calendar.YEAR); } - public static Date getEarliestDate() { + static Date getEarliestDate() { Calendar cal = getCalendarInstance(TimeZone.getTimeZone("GMT"), Locale.getDefault()); cal.set(Calendar.YEAR, cal.getActualMinimum(Calendar.YEAR)); cal.set(Calendar.MONTH, cal.getActualMinimum(Calendar.MONTH)); @@ -1127,7 +1127,7 @@ public final class UtilDateTime { return cal.getTime(); } - public static Date getLatestDate() { + static Date getLatestDate() { Calendar cal = getCalendarInstance(TimeZone.getTimeZone("GMT"), Locale.getDefault()); cal.set(Calendar.YEAR, cal.getActualMaximum(Calendar.YEAR)); cal.set(Calendar.MONTH, cal.getActualMaximum(Calendar.MONTH)); @@ -1146,7 +1146,7 @@ public final class UtilDateTime { * @param date the date to copy * @return an immutable copy of {@code date}. */ - public static Date unmodifiableDate(Date date) { + static Date unmodifiableDate(Date date) { if (date instanceof ImmutableDate) { return date; } 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 87149fd486..9114fd62bc 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 @@ -44,7 +44,7 @@ public final class UtilFormatOut { private UtilFormatOut() { } - public static String safeToString(Object obj) { + static String safeToString(Object obj) { if (obj != null) { return obj.toString(); } @@ -123,7 +123,7 @@ public final class UtilFormatOut { * @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(double price, String isoCode, Locale locale, int maximumFractionDigits) { + private 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)); 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 91b7810d2f..4ae10c04ca 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 */ - public static Map<String, Object> getAttributeMap(HttpServletRequest request, Set<? extends String> namesToSkip) { + private 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 */ - public static Map<String, Object> getSessionMap(HttpServletRequest request, Set<? extends String> namesToSkip) { + private 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 */ - public static Map<String, Object> getServletContextMap(HttpServletRequest request, Set<? extends String> namesToSkip) { + private 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)); } - public static void setTimeZone(HttpSession session, TimeZone timeZone) { + private static void setTimeZone(HttpSession session, TimeZone timeZone) { session.setAttribute(SESSION_KEY_TIMEZONE, timeZone); } @@ -1362,7 +1362,7 @@ public final class UtilHttp { * @param length Size (in bytes) of the content * @throws IOException */ - public static void streamContent(OutputStream out, InputStream in, int length) throws IOException { + private static void streamContent(OutputStream out, InputStream in, int length) throws IOException { // make sure we have something to write to if (out == null) { throw new IOException("Attempt to write to null output stream"); @@ -1705,7 +1705,7 @@ public final class UtilHttp { return "autoId_" + uniqueIdNumber; } - public static void setContentDisposition(final HttpServletResponse response, final String filename) { + private static void setContentDisposition(final HttpServletResponse response, final String filename) { String dispositionType = UtilProperties.getPropertyValue("requestHandler", "content-disposition-type", "attachment"); response.setHeader("Content-Disposition", String.format("%s; filename=\"%s\"", dispositionType, filename)); } @@ -1714,7 +1714,7 @@ public final class UtilHttp { return getAllowAllHttpClient("component://base/config/ofbizssl.jks", "changeit"); } - public static CloseableHttpClient getAllowAllHttpClient(String jksStoreFileName, String jksStorePassword) { + private static CloseableHttpClient getAllowAllHttpClient(String jksStoreFileName, String jksStorePassword) { try { // Trust own CA and all self-signed certs SSLContext sslContext = SSLContexts.custom() 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 878f222f6c..d2923ca628 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 */ - public static Double toDoubleObject(Object obj) { + private 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 */ - public static Long toLongObject(Object obj) { + private 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 922ce65c21..f244e935cd 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 @@ -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. */ - public static RoundingMode roundingModeFromString(String value) { + private 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 */ - public static String formatRuleBasedAmount(double amount, String ruleSet, String rule, Locale locale) { + private 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. */ - public static String toPercentString(Number number, int scale, RoundingMode roundingMode) { + private 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/UtilPlist.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java index 0e2cfc8d64..c0a48cad5d 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilPlist.java @@ -42,7 +42,7 @@ public final class UtilPlist { /** simple 4 char indentation */ private static final String INDENT_FOUR_STRING = " "; - public static void writePlistProperty(String name, Object value, int indentLevel, PrintWriter writer) { + private static void writePlistProperty(String name, Object value, int indentLevel, PrintWriter writer) { for (int i = 0; i < indentLevel; i++) { writer.print(INDENT_FOUR_STRING); } @@ -77,7 +77,7 @@ public final class UtilPlist { writer.println("}"); } } - public static void writePlistPropertyValueList(List<Object> propertyValueList, int indentLevel, PrintWriter writer) { + private static void writePlistPropertyValueList(List<Object> propertyValueList, int indentLevel, PrintWriter writer) { for (int i = 0; i < indentLevel; i++) { writer.print(INDENT_FOUR_STRING); } @@ -103,7 +103,7 @@ public final class UtilPlist { writer.println(");"); } - public static void writePlistPropertyXml(String name, Object value, int indentLevel, PrintWriter writer) { + private static void writePlistPropertyXml(String name, Object value, int indentLevel, PrintWriter writer) { for (int i = 0; i < indentLevel; i++) { writer.print(INDENT_FOUR_STRING); } @@ -125,7 +125,7 @@ public final class UtilPlist { writer.println("</string>"); } } - public static void writePlistPropertyMapXml(Map<String, Object> propertyMap, int indentLevel, PrintWriter writer) { + private static void writePlistPropertyMapXml(Map<String, Object> propertyMap, int indentLevel, PrintWriter writer) { for (int i = 0; i < indentLevel; i++) { writer.print(INDENT_FOUR_STRING); } @@ -138,7 +138,7 @@ public final class UtilPlist { } writer.println("</dict>"); } - public static void writePlistPropertyValueListXml(List<Object> propertyValueList, int indentLevel, PrintWriter writer) { + private static void writePlistPropertyValueListXml(List<Object> propertyValueList, int indentLevel, PrintWriter writer) { for (int i = 0; i < indentLevel; i++) { writer.print(INDENT_FOUR_STRING); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java index 5ac0897f26..e2f8fea9ab 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilProperties.java @@ -1024,7 +1024,7 @@ public final class UtilProperties implements Serializable { protected UtilResourceBundle() { } - public UtilResourceBundle(Properties properties, Locale locale, UtilResourceBundle parent) { + UtilResourceBundle(Properties properties, Locale locale, UtilResourceBundle parent) { this.properties = properties; this.locale = locale; setParent(parent); @@ -1125,7 +1125,7 @@ public final class UtilProperties implements Serializable { public ExtendedProperties(Properties defaults) { super(defaults); } - public ExtendedProperties(URL url, Locale locale) throws IOException, InvalidPropertiesFormatException { + ExtendedProperties(URL url, Locale locale) throws IOException, InvalidPropertiesFormatException { try (InputStream in = new BufferedInputStream(url.openStream())) { if (url.getFile().endsWith(".xml")) { xmlToProperties(in, locale, this); 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 7b02183c63..fba0827677 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. */ - public void startTimer() { + private 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 */ - public double secondsSinceStart() { + private 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 */ - public double secondsSinceLast() { + private double secondsSinceLast() { return (timeSinceLast()) / 1000.0; } /** Returns the number of milliseconds since the timer started * @return The number of milliseconds since the timer started */ - public long timeSinceStart() { + private 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! - public static UtilTimer getTimer(String timerName) { + private static UtilTimer getTimer(String timerName) { return getTimer(timerName, true); } - public static UtilTimer getTimer(String timerName, boolean log) { + private 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 e1655f83b8..fd894e3ffa 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; } - public static URL fromOfbizHomePath(String filename) { + private 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 8117565c87..be8b3e832f 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 @@ -302,7 +302,7 @@ public final class UtilValidate { * Returns true if string s is an integer > 0. * NOTE: using the Java Long object for greatest precision */ - public static boolean isPositiveInteger(String s) { + private 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 >= 0 */ - public static boolean isNonnegativeInteger(String s) { + private static boolean isNonnegativeInteger(String s) { if (isEmpty(s)) { return DEFAULT_EMPTY_OK; } @@ -552,7 +552,7 @@ public final class UtilValidate { } /** isZIPCode returns true if string s is a valid U.S. ZIP code. Must be 5 or 9 digits only. */ - public static boolean isZipCode(String s) { + private static boolean isZipCode(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. */ - public static boolean isYear(String s) { + private 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. */ - public static boolean isMonth(String s) { + private 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. */ - public static boolean isDay(String s) { + private 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. */ - public static int daysInFebruary(int year) { + private 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. */ - public static boolean isHour(String s) { + private 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. */ - public static boolean isTime(String hour, String minute, String second) { + private 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 */ - public static boolean isValueLinkCard(String stPassed) { + private 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 */ - public static boolean isOFBGiftCard(String stPassed) { + private 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 */ - public static boolean isCreditCard(String stPassed) { + private 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 */ - public static boolean isVisa(String cc) { + private 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 */ - public static boolean isMasterCard(String cc) { + private 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 */ - public static boolean isAmericanExpress(String cc) { + private 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 */ - public static boolean isDinersClub(String cc) { + private 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 */ - public static boolean isCarteBlanche(String cc) { + private 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 */ - public static boolean isDiscover(String cc) { + private 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 */ - public static boolean isEnRoute(String cc) { + private 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 */ - public static boolean isJCB(String cc) { + private 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 */ - public static boolean isSwitch(String cc) { + private static boolean isSwitch(String cc) { String first4digs = cc.substring(0, 4); String first6digs = cc.substring(0, 6); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java index db2e18a916..0ac2e2ada8 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilXml.java @@ -125,7 +125,7 @@ public final class UtilXml { * @return A <code>LSOutput</code> instance * @see <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/">DOM Level 3 Load and Save Specification</a> */ - public static LSOutput createLSOutput(DOMImplementationLS impl, OutputStream os, String encoding) { + private static LSOutput createLSOutput(DOMImplementationLS impl, OutputStream os, String encoding) { LSOutput out = impl.createLSOutput(); if (os != null) { out.setByteStream(os); @@ -146,7 +146,7 @@ public final class UtilXml { * @return A <code>LSSerializer</code> instance * @see <a href="http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/">DOM Level 3 Load and Save Specification</a> */ - public static LSSerializer createLSSerializer(DOMImplementationLS impl, boolean includeXmlDeclaration, boolean enablePrettyPrint) { + private static LSSerializer createLSSerializer(DOMImplementationLS impl, boolean includeXmlDeclaration, boolean enablePrettyPrint) { LSSerializer writer = impl.createLSSerializer(); DOMConfiguration domConfig = writer.getDomConfig(); domConfig.setParameter("xml-declaration", includeXmlDeclaration); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java index 5adff0fdbc..9549a24fa6 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheLine.java @@ -21,7 +21,7 @@ package org.apache.ofbiz.base.util.cache; import org.apache.ofbiz.base.concurrent.ExecutionPool; public abstract class CacheLine<V> extends ExecutionPool.Pulse { - protected CacheLine(long loadTimeNanos, long expireTimeNanos) { + CacheLine(long loadTimeNanos, long expireTimeNanos) { super(loadTimeNanos, expireTimeNanos); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java index bf61d7d3c5..1cbe75586c 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/CacheSoftReference.java @@ -25,7 +25,7 @@ public abstract class CacheSoftReference<V> extends ReferenceCleaner.Soft<V> { private static final String MODULE = CacheSoftReference.class.getName(); - public CacheSoftReference(V o) { + CacheSoftReference(V o) { super(o); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/HardRefCacheLine.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/HardRefCacheLine.java index 465b6fff4c..22e78b2cec 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/HardRefCacheLine.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/HardRefCacheLine.java @@ -21,7 +21,7 @@ package org.apache.ofbiz.base.util.cache; public abstract class HardRefCacheLine<V> extends CacheLine<V> { private final V value; - public HardRefCacheLine(V value, long loadTimeNanos, long expireTimeNanos) { + HardRefCacheLine(V value, long loadTimeNanos, long expireTimeNanos) { super(loadTimeNanos, expireTimeNanos); this.value = value; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/SoftRefCacheLine.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/SoftRefCacheLine.java index edc9cf76ad..2a4c300392 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/SoftRefCacheLine.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/SoftRefCacheLine.java @@ -22,7 +22,7 @@ package org.apache.ofbiz.base.util.cache; public abstract class SoftRefCacheLine<V> extends CacheLine<V> { private final CacheSoftReference<V> ref; - public SoftRefCacheLine(V value, long loadTimeNanos, long expireTimeNanos) { + SoftRefCacheLine(V value, long loadTimeNanos, long expireTimeNanos) { super(loadTimeNanos, expireTimeNanos); this.ref = new CacheSoftReference<V>(value) { @Override diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java index dace45081b..b3e3b07a45 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/cache/UtilCache.java @@ -149,7 +149,7 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj return i == 0 ? "" : Integer.toString(i); } - public static String getPropertyParam(ResourceBundle res, String[] propNames, String parameter) { + private static String getPropertyParam(ResourceBundle res, String[] propNames, String parameter) { try { for (String propName : propNames) { String key = propName.concat(".").concat(parameter); @@ -166,15 +166,15 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj return null; } - protected void setPropertiesParams(String cacheName) { + private void setPropertiesParams(String cacheName) { setPropertiesParams(new String[] {cacheName}); } - public void setPropertiesParams(String[] propNames) { + private void setPropertiesParams(String[] propNames) { setPropertiesParams("cache", propNames); } - public void setPropertiesParams(String settingsResourceName, String[] propNames) { + private void setPropertiesParams(String settingsResourceName, String[] propNames) { ResourceBundle res = ResourceBundle.getBundle(settingsResourceName); if (res != null) { @@ -411,7 +411,7 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj /** This is used for internal remove calls because we only want to count external calls */ @SuppressWarnings("unchecked") - protected synchronized V removeInternal(Object key, boolean countRemove) { + private synchronized V removeInternal(Object key, boolean countRemove) { if (key == null) { if (Debug.verboseOn()) { Debug.logVerbose("In UtilCache tried to remove with null key, using NullObject" + this.name, MODULE); @@ -438,7 +438,7 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj return null; } - protected synchronized void removeInternal(Object key, CacheLine<V> existingCacheLine) { + private synchronized void removeInternal(Object key, CacheLine<V> existingCacheLine) { Object nulledKey = fromKey(key); cancel(existingCacheLine); if (!memoryTable.remove(nulledKey, existingCacheLine)) { @@ -501,14 +501,14 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj /** Returns the number of cache misses from entries that are expired * @return The number of cache misses */ - public long getMissCountExpired() { + private long getMissCountExpired() { return this.missCountExpired.get(); } /** Returns the number of cache misses from entries that are have had the soft reference cleared out (by garbage collector and such) * @return The number of cache misses */ - public long getMissCountSoftRef() { + private long getMissCountSoftRef() { return this.missCountSoftRef.get(); } @@ -529,7 +529,7 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj /** Clears the hit and miss counters */ - public void clearCounters() { + private void clearCounters() { this.hitCount.set(0); this.missCountNotFound.set(0); this.missCountExpired.set(0); @@ -678,21 +678,21 @@ public final class UtilCache<K, V> implements Serializable, EvictionListener<Obj } /** Send a key addition event to all registered listeners */ - protected void noteAddition(K key, V newValue) { + private void noteAddition(K key, V newValue) { for (CacheListener<K, V> listener: listeners) { listener.noteKeyAddition(this, key, newValue); } } /** Send a key removal event to all registered listeners */ - protected void noteRemoval(K key, V oldValue) { + private void noteRemoval(K key, V oldValue) { for (CacheListener<K, V> listener: listeners) { listener.noteKeyRemoval(this, key, oldValue); } } /** Send a key update event to all registered listeners */ - protected void noteUpdate(K key, V newValue, V oldValue) { + private void noteUpdate(K key, V newValue, V oldValue) { for (CacheListener<K, V> listener: listeners) { listener.noteKeyUpdate(this, key, newValue, oldValue); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java index 48b2a4eb7d..441b67aed7 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMap.java @@ -106,7 +106,7 @@ public abstract class GenericMap<K, V> implements Appender<StringBuilder>, Map<K * @param map the map * @return the boolean */ - protected boolean equalsGenericMap(GenericMap<?, ?> map) { + private boolean equalsGenericMap(GenericMap<?, ?> map) { Iterator<Map.Entry<K, V>> it = iterator(false); while (it.hasNext()) { Map.Entry<K, V> entry = it.next(); @@ -134,7 +134,7 @@ public abstract class GenericMap<K, V> implements Appender<StringBuilder>, Map<K * @param map the map * @return the boolean */ - protected boolean equalsMap(Map<?, ?> map) { + private boolean equalsMap(Map<?, ?> map) { Iterator<Map.Entry<K, V>> it = iterator(false); while (it.hasNext()) { Map.Entry<K, V> entry = it.next(); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapCollection.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapCollection.java index 83ab7e0993..d2b5f4beef 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapCollection.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapCollection.java @@ -35,7 +35,7 @@ public abstract class GenericMapCollection<K, V, M extends Map<K, V>, I> impleme return source; } - public GenericMapCollection(M source) { + GenericMapCollection(M source) { this.source = source; } @@ -136,7 +136,7 @@ public abstract class GenericMapCollection<K, V, M extends Map<K, V>, I> impleme * @param sb the sb * @return the string builder */ - public StringBuilder appendTo(StringBuilder sb) { + private StringBuilder appendTo(StringBuilder sb) { sb.append("["); Iterator<I> it = iterator(false); while (it.hasNext()) { diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapEntrySet.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapEntrySet.java index 601fd6f1d7..a0249b51c7 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapEntrySet.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapEntrySet.java @@ -21,7 +21,7 @@ package org.apache.ofbiz.base.util.collections; import java.util.Map; public abstract class GenericMapEntrySet<K, V, M extends GenericMap<K, V>> extends GenericMapSet<K, V, M, Map.Entry<K, V>> { - public GenericMapEntrySet(M source) { + GenericMapEntrySet(M source) { super(source); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapKeySet.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapKeySet.java index 3a1bf207a4..81293fe0b4 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapKeySet.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapKeySet.java @@ -21,7 +21,7 @@ package org.apache.ofbiz.base.util.collections; import java.util.Map; public abstract class GenericMapKeySet<K, V, M extends Map<K, V>> extends GenericMapSet<K, V, M, K> { - public GenericMapKeySet(M source) { + GenericMapKeySet(M source) { super(source); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapSet.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapSet.java index 280bdfdaac..899d9887ab 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapSet.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapSet.java @@ -22,7 +22,7 @@ import java.util.Map; import java.util.Set; public abstract class GenericMapSet<K, V, M extends Map<K, V>, I> extends GenericMapCollection<K, V, M, I> implements Set<I> { - public GenericMapSet(M source) { + GenericMapSet(M source) { super(source); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapValues.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapValues.java index 3a6e70cf56..54938a18ba 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapValues.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/GenericMapValues.java @@ -26,7 +26,7 @@ import java.util.Objects; import java.util.Set; public abstract class GenericMapValues<K, V, M extends Map<K, V>> extends GenericMapCollection<K, V, M, V> { - public GenericMapValues(M source) { + GenericMapValues(M source) { super(source); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LRUMap.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LRUMap.java index 82894631c5..628618f0d6 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LRUMap.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/LRUMap.java @@ -33,15 +33,15 @@ public class LRUMap<K, V> extends LinkedHashMap<K, V> { this(10); } - public LRUMap(int size) { + private LRUMap(int size) { this(size, 16); } - public LRUMap(int size, int initialCapacity) { + private LRUMap(int size, int initialCapacity) { this(size, initialCapacity, (float) .75); } - public LRUMap(int size, int initialCapacity, float loadFactor) { + private LRUMap(int size, int initialCapacity, float loadFactor) { super(initialCapacity, loadFactor, true); maxSize = size; } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MapContext.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MapContext.java index 34f8141b7a..321f0c15b9 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MapContext.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/collections/MapContext.java @@ -72,7 +72,7 @@ public class MapContext<K, V> implements Map<K, V>, LocalizedMap<V> { /** Puts an existing Map on the BOTTOM of the stack (bottom meaning will be overriden by lower layers on the stack, * ie everything else already there) */ - public void addToBottom(Map<K, V> existingMap) { + void addToBottom(Map<K, V> existingMap) { if (existingMap == null) { throw new IllegalArgumentException("Error: cannot add null existing Map to bottom of a MapContext"); } diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java index 62b8e8affa..2900952878 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java @@ -288,7 +288,7 @@ public class UelFunctions { return str1.replaceAll(str2, str3); } - public static String replaceFirst(String str1, String str2, String str3) { + private static String replaceFirst(String str1, String str2, String str3) { if (null == str1) return null; return StringUtils.replaceOnce(str1, str2, str3); } @@ -361,7 +361,7 @@ public class UelFunctions { return null; } - public static Document readHtmlDocument(String str) { + private static Document readHtmlDocument(String str) { Document document = null; try { URL url = FlexibleLocation.resolveLocation(str); @@ -415,7 +415,7 @@ public class UelFunctions { return false; } - public static String toHtmlString(Node node, String encoding, boolean indent, int indentAmount) { + private static String toHtmlString(Node node, String encoding, boolean indent, int indentAmount) { try { StringBuilder sb = new StringBuilder(); sb.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); @@ -447,7 +447,7 @@ public class UelFunctions { return null; } - public static String toXmlString(Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) { + private static String toXmlString(Node node, String encoding, boolean omitXmlDeclaration, boolean indent, int indentAmount) { try (ByteArrayOutputStream os = new ByteArrayOutputStream();) { UtilXml.writeXmlDocument(node, os, encoding, omitXmlDeclaration, indent, indentAmount); return os.toString(); diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java index a77d9a051e..cd34a35800 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelUtil.java @@ -458,7 +458,7 @@ public final class UelUtil { * @return New <code>List</code> or <code>Map</code> */ @SuppressWarnings("rawtypes") - public static Object autoVivifyListOrMap(Object property) { + static Object autoVivifyListOrMap(Object property) { String str = property.toString(); boolean isList = ("add".equals(str) || str.startsWith("insert@")); if (!isList && !"java.lang.String".equals(property.getClass().getName())) { @@ -493,7 +493,7 @@ public final class UelUtil { return result; } - public static Object resolveVariable(String variable, Map<String, ? extends Object> variables, Locale locale) { + private static Object resolveVariable(String variable, Map<String, ? extends Object> variables, Locale locale) { Object obj = null; String createObjectType = null; String name = variable;