You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2015/06/09 03:55:29 UTC

logging-log4j2 git commit: [LOG4J2-934] Circular suppressed Exception throws StackOverflowError. Better var names to distinguish from causes visited.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 6cb499b7a -> 8fc7bcd3f


[LOG4J2-934] Circular suppressed Exception throws StackOverflowError.
Better var names to distinguish from causes visited.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8fc7bcd3
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8fc7bcd3
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8fc7bcd3

Branch: refs/heads/master
Commit: 8fc7bcd3f981437972f4dfa953a28bf1ae0f1fb7
Parents: 6cb499b
Author: Gary Gregory <ga...@gmail.com>
Authored: Mon Jun 8 18:55:26 2015 -0700
Committer: Gary Gregory <ga...@gmail.com>
Committed: Mon Jun 8 18:55:26 2015 -0700

----------------------------------------------------------------------
 .../logging/log4j/core/impl/ThrowableProxy.java | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8fc7bcd3/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
index f8d4718..dbbc808 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxy.java
@@ -136,17 +136,17 @@ public class ThrowableProxy implements Serializable {
      *        The cache containing the packaging data.
      * @param cause
      *        The Throwable to wrap.
-     * @param visited TODO
+     * @param suppressedVisited TODO
      */
     private ThrowableProxy(final Throwable parent, final Stack<Class<?>> stack, final Map<String, CacheEntry> map,
-            final Throwable cause, Set<Throwable> visited) {
+            final Throwable cause, Set<Throwable> suppressedVisited) {
         this.throwable = cause;
         this.name = cause.getClass().getName();
         this.message = this.throwable.getMessage();
         this.localizedMessage = this.throwable.getLocalizedMessage();
         this.extendedStackTrace = this.toExtendedStackTrace(stack, map, parent.getStackTrace(), cause.getStackTrace());
-        this.causeProxy = cause.getCause() == null ? null : new ThrowableProxy(parent, stack, map, cause.getCause(), visited);
-        this.suppressedProxies = this.toSuppressedProxies(cause, visited);
+        this.causeProxy = cause.getCause() == null ? null : new ThrowableProxy(parent, stack, map, cause.getCause(), suppressedVisited);
+        this.suppressedProxies = this.toSuppressedProxies(cause, suppressedVisited);
     }
 
     @Override
@@ -595,21 +595,21 @@ public class ThrowableProxy implements Serializable {
         return msg != null ? this.name + ": " + msg : this.name;
     }
 
-    private ThrowableProxy[] toSuppressedProxies(final Throwable thrown, Set<Throwable> visited) {
+    private ThrowableProxy[] toSuppressedProxies(final Throwable thrown, Set<Throwable> suppressedVisited) {
         try {
             final Throwable[] suppressed = Throwables.getSuppressed(thrown);
             if (suppressed == null) {
                 return EMPTY_THROWABLE_PROXY_ARRAY;
             }
             final List<ThrowableProxy> proxies = new ArrayList<>(suppressed.length);
-            if (visited == null) {
-                visited = new HashSet<>(proxies.size());
+            if (suppressedVisited == null) {
+                suppressedVisited = new HashSet<>(proxies.size());
             }
             for (int i = 0; i < suppressed.length; i++) {
                 final Throwable candidate = suppressed[i];
-                if (!visited.contains(candidate)) {
-                    visited.add(candidate);
-                    proxies.add(new ThrowableProxy(candidate, visited));
+                if (!suppressedVisited.contains(candidate)) {
+                    suppressedVisited.add(candidate);
+                    proxies.add(new ThrowableProxy(candidate, suppressedVisited));
                 }
             }
             return proxies.toArray(new ThrowableProxy[proxies.size()]);