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

Ralph Goers commented on LOG4J2-2564:
-------------------------------------

I plan to perform the release build for 2.12.0 tomorrow. After the build is 
done it has to be voted on. If there are no problems the vote will remain open 
for 72hrs. If there are problems then a new release candidate would have to be 
created and voted on. 

> Error using %K in pattern : MapPatternConverter cannot contain multiple 
> static newInstance method
> -------------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2564
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2564
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.11.2
>            Reporter: Anthony Communier
>            Assignee: Carter Kozak
>            Priority: Blocker
>             Fix For: 2.12.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> When using a %K in a pattern, the MapPatterConverter is used and there is an 
> error message :
> ERROR Class class org.apache.logging.log4j.core.pattern.MapPatternConverter 
> cannot contain multiple static newInstance methods
>  
> The control is done by 
> org.apache.logging.log4j.core.pattern.PatternParser.createConverter here :
> {{ _// Work around the regression bug in Class.getDeclaredMethods() in Oracle 
> Java in version > 1.6.0_17:_}}
> {{        _// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6815786_}}
> {{        _final Method[] methods = converterClass.getDeclaredMethods();_}}
> {{        _Method newInstanceMethod = null;_}}
> {{        _for (final Method method : methods) {_}}
> {{            _if (Modifier.isStatic(method.getModifiers()) && 
> method.getDeclaringClass().equals(converterClass)_}}
> {{                    _&& method.getName().equals("newInstance")) {_}}
> {{                _if (newInstanceMethod == null) {_}}
> {{                    _newInstanceMethod = method;_}}
> {{                _} else if 
> (method.getReturnType().equals(newInstanceMethod.getReturnType())) {_}}
> {{                    _LOGGER.error("Class " + converterClass + " cannot 
> contain multiple static newInstance methods");_}}
> {{                    _return null;_}}
> {{                _}_}}
> {{            _}_}}
> {{        _}_}}
>  
> The class org.apache.logging.log4j.core.pattern.MapPatternConverter contains 
> 2 *newInstances* message (teh second introduced in 2.11.2)
>  
>  _/**_
>      _* Obtains an instance of \{@link MapPatternConverter}._
>      _*_
>      _* @param options options, may be null or first element contains name of 
> property to format._
>      _* @return instance of \{@link MapPatternConverter}._
>      _*/_
>     _public static MapPatternConverter newInstance(final String[] options) {_
>         _return new MapPatternConverter(options, JAVA_UNQUOTED);_
>     _}_
> {color:#d04437}    _/**_{color}
> {color:#d04437}     _* Obtain an instance of \{@link 
> MapPatternConverter}._{color}
> {color:#d04437}     _*_{color}
> {color:#d04437}     _* @param options options, may be null or first element 
> contains name of property to format._{color}
> {color:#d04437}     _* @param format the format to use if no options are 
> given (i.e., options is null). Ignored if options is non-null._{color}
> {color:#d04437}     _* @return instance of \{@link 
> MapPatternConverter}._{color}
> {color:#d04437}     _* @since 2.11.2_{color}
> {color:#d04437}     _*/_{color}
> {color:#d04437}    _public static MapPatternConverter newInstance(final 
> String[] options, final MapFormat format) {_{color}
> {color:#d04437}        _return new MapPatternConverter(options, 
> Objects.toString(format, JAVA_UNQUOTED));_{color}
> {color:#d04437}    _}_{color}
>  
>  



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

Reply via email to