yijack yau created LOG4J2-2622:
----------------------------------

             Summary: 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


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)

Reply via email to