You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by GitBox <gi...@apache.org> on 2023/01/17 23:06:02 UTC

[GitHub] [logging-log4j2] alex-dubrouski commented on a diff in pull request #1214: This change fixes incorrect behavior of stack elements cache.

alex-dubrouski commented on code in PR #1214:
URL: https://github.com/apache/logging-log4j2/pull/1214#discussion_r1072914968


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/impl/ThrowableProxyHelper.java:
##########
@@ -85,7 +85,7 @@ static ExtendedStackTraceElement[] toExtendedStackTrace(
             stackLength = stackTrace.length;
         }
         final ExtendedStackTraceElement[] extStackTrace = new ExtendedStackTraceElement[stackLength];
-        Class<?> clazz = stack.isEmpty() ? null : stack.peek();
+        Class<?> clazz = stack.isEmpty() ? null : stack.peekLast();

Review Comment:
   <img width="1407" alt="Screen Shot 2023-01-17 at 2 43 45 PM" src="https://user-images.githubusercontent.com/36453467/213029221-bf8ab0c5-07f1-47d3-99c3-92c6326e635e.png">
   <img width="1683" alt="Screen Shot 2023-01-17 at 2 46 02 PM" src="https://user-images.githubusercontent.com/36453467/213029231-6d9dc2cf-dfe7-4cca-940d-3b48c5817437.png">
   Order of elements in stack did not change between 2.17.1 and 2.19.0 at least from the index number point of view.
   I might have misunderstood you, sorry about that. Would like me to change the order of stack elements and preserve the current code in `ThrowableProxyHelper` or keep my changes to helper and don't change `StackLocator` as I assume these changed are mutually exclusive.
   I might need some time to develop a unit test as there is no tests for helper class so far
   
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@logging.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org