You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/08/05 13:25:16 UTC

(commons-beanutils) 01/06: Javadoc

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

ggregory pushed a commit to branch 1.X
in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git

commit 32cc76d0a0fd5aade2013a87e7d0972f206af348
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Tue Aug 5 09:13:36 2025 -0400

    Javadoc
    
    Reduce vertical whitespace
---
 .../commons/beanutils/ContextClassLoaderLocal.java | 28 +++++++---------------
 1 file changed, 9 insertions(+), 19 deletions(-)

diff --git a/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java b/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java
index 6c801ac0..6cd32dba 100644
--- a/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java
+++ b/src/main/java/org/apache/commons/beanutils/ContextClassLoaderLocal.java
@@ -98,7 +98,7 @@ import java.util.WeakHashMap;
  * needs, ie avoided providing classes loaded via a "shared" classloader.</p>
  *
  * @param <T> the type of data stored in an instance
- * @see java.lang.Thread#getContextClassLoader
+ * @see Thread#getContextClassLoader
  */
 public class ContextClassLoaderLocal<T> {
     private final Map<ClassLoader, T> valueByClassLoader = new WeakHashMap<>();
@@ -121,31 +121,25 @@ public class ContextClassLoaderLocal<T> {
         // synchronizing the whole method is a bit slower
         // but guarantees no subtle threading problems, and there's no
         // need to synchronize valueByClassLoader
-
         // make sure that the map is given a change to purge itself
         valueByClassLoader.isEmpty();
         try {
-
             final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
             if (contextClassLoader != null) {
-
                 T value = valueByClassLoader.get(contextClassLoader);
-                if (value == null
-                && !valueByClassLoader.containsKey(contextClassLoader)) {
+                if (value == null && !valueByClassLoader.containsKey(contextClassLoader)) {
                     value = initialValue();
                     valueByClassLoader.put(contextClassLoader, value);
                 }
                 return value;
-
             }
-
-        } catch (final SecurityException e) { /* SWALLOW - should we log this? */ }
-
+        } catch (final SecurityException e) {
+            /* SWALLOW - should we log this? */ }
         // if none or exception, return the globalValue
         if (!globalValueInitialized) {
             globalValue = initialValue();
             globalValueInitialized = true;
-        }//else already set
+        } // else already set
         return globalValue;
     }
 
@@ -175,19 +169,16 @@ public class ContextClassLoaderLocal<T> {
     public synchronized void set(final T value) {
         // synchronizing the whole method is a bit slower
         // but guarentees no subtle threading problems
-
         // make sure that the map is given a change to purge itself
         valueByClassLoader.isEmpty();
         try {
-
             final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
             if (contextClassLoader != null) {
                 valueByClassLoader.put(contextClassLoader, value);
                 return;
             }
-
-        } catch (final SecurityException e) { /* SWALLOW - should we log this? */ }
-
+        } catch (final SecurityException e) {
+            /* SWALLOW - should we log this? */ }
         // if in doubt, set the global value
         globalValue = value;
         globalValueInitialized = true;
@@ -198,11 +189,10 @@ public class ContextClassLoaderLocal<T> {
      */
     public synchronized void unset() {
         try {
-
             final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
             unset(contextClassLoader);
-
-        } catch (final SecurityException e) { /* SWALLOW - should we log this? */ }
+        } catch (final SecurityException e) {
+            /* SWALLOW - should we log this? */ }
     }
 
     /**