[ 
https://issues.apache.org/jira/browse/LOG4J2-2363?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16573469#comment-16573469
 ] 

ASF GitHub Bot commented on LOG4J2-2363:
----------------------------------------

Github user cakofony commented on a diff in the pull request:

    https://github.com/apache/logging-log4j2/pull/203#discussion_r208651767
  
    --- Diff: 
log4j-api/src/main/java/org/apache/logging/log4j/message/ReusableObjectMessage.java
 ---
    @@ -100,16 +100,17 @@ public Throwable getThrowable() {
          */
         @Override
         public Object[] swapParameters(final Object[] emptyReplacement) {
    +        emptyReplacement[0] = obj;
    --- End diff --
    
    I can't imagine that `emptyReplacement` should ever be empty, but it might 
be worth  doing something along these lines:
    
    ```java
    if (emptyReplacement.length == 0) {
        Object[] params = new Object[10]; // Default reusable parameter buffer 
size
        params[0] = obj;
        return params;
    }
    emptyReplacement[0] = obj;
    return emptyReplacement;
    ```


> ReusableObjectMessage does not pass object parameter to reusable events
> -----------------------------------------------------------------------
>
>                 Key: LOG4J2-2363
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2363
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.11.0, 2.11.1
>            Reporter: Carter Kozak
>            Assignee: Carter Kozak
>            Priority: Major
>             Fix For: 3.0.0, 2.11.2
>
>
> swapParameters returns the unmodified input array. Implementations of 
> swapParameters should agree with the value returned from getParameters.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to