You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2019/06/23 05:31:00 UTC

[jira] [Commented] (LOG4J2-2622) maxLength for StructuredDataId and StructuredDataMessage always maximum 32

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

ASF subversion and git services commented on LOG4J2-2622:
---------------------------------------------------------

Commit 8a5b2e0ba2e8d28479d1042f0f62e114bc04602c in logging-log4j2's branch refs/heads/release-2.x from Ralph Goers
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=8a5b2e0 ]

LOG4J2-2622 - StructuredDataId was ignoring maxLength atribute


> maxLength for StructuredDataId and StructuredDataMessage always maximum 32
> --------------------------------------------------------------------------
>
>                 Key: LOG4J2-2622
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2622
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 2.11.2
>            Reporter: yijack yau
>            Priority: Major
>
> Try to assign UUID into the StructuredDataMessage, but failed with :
> {code}
> Exception in thread "main" java.lang.IllegalArgumentException: Length of id dd570301-85b6-11e9-a708-983b8f59247d exceeds maximum of 37 characters
>  at org.apache.logging.log4j.message.StructuredDataId.<init>(StructuredDataId.java:103)
> {code}
> Found the bug in the code 
> https://github.com/apache/logging-log4j2/blob/master/log4j-api/src/main/java/org/apache/logging/log4j/message/StructuredDataId.java
> {code}
>     public StructuredDataId(final String name, final String[] required, final String[] optional,
>                                final int maxLength) {
>         int index = -1;
>         if (name != null) {
>             if (maxLength > 0 && name.length() > MAX_LENGTH) {
>                 throw new IllegalArgumentException(String.format("Length of id %s exceeds maximum of %d characters",
>                         name, maxLength));
>             }
>             index = name.indexOf(AT_SIGN);
>         }
> {code}
> at line 102 , should be 
> name.length() > maxLength that bring in but the the MAX_LENGTH



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