You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Remko Popma (Jira)" <ji...@apache.org> on 2020/04/04 12:34:00 UTC

[jira] [Commented] (LOG4J2-2813) Questionable code in AbstractStringLayout.serializeToBytes()

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

Remko Popma commented on LOG4J2-2813:
-------------------------------------

Good catch!

> Questionable code in AbstractStringLayout.serializeToBytes()
> ------------------------------------------------------------
>
>                 Key: LOG4J2-2813
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2813
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Layouts
>    Affects Versions: 2.13.1
>            Reporter: Keith D Gregory
>            Priority: Trivial
>
> Source from [current master|https://git-wip-us.apache.org/repos/asf?p=logging-log4j2.git;a=blob;f=log4j-core/src/main/java/org/apache/logging/log4j/core/layout/AbstractStringLayout.java;h=76c00b235992e4316107c1727e0473e5043d565b;hb=HEAD#l280]:
> {code:java}
> protected byte[] serializeToBytes(final Serializer serializer, final byte[] defaultValue) {
>     final String serializable = serializeToString(serializer);
>     if (serializer == null) {
>         return defaultValue;
>     }
>     return StringEncoder.toBytes(serializable, getCharset());
> }
> {code}
> I believe the test should be on "{{serializable}}" not "{{serializer}}".
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)