You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Jeff Thomas (Jira)" <ji...@apache.org> on 2025/01/06 10:01:00 UTC

[jira] [Closed] (LOG4J2-3694) Javadoc: TypeConverters convert for "Level" incorrectly documents behaviour for invalid value

     [ https://issues.apache.org/jira/browse/LOG4J2-3694?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Thomas closed LOG4J2-3694.
-------------------------------
    Resolution: Duplicate

> Javadoc: TypeConverters convert for "Level" incorrectly documents behaviour for invalid value
> ---------------------------------------------------------------------------------------------
>
>                 Key: LOG4J2-3694
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3694
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: API, Configuration
>    Affects Versions: 2.24.0
>            Reporter: Jeff Thomas
>            Priority: Trivial
>              Labels: newbie
>
> Minor Javadoc correction.
> In TypeConverters, the conversion for type "Level" says it returns 'null' for invalid levels:
> {code:java}
> /**
>  * Converts a {@link String} into a Log4j {@link Level}. Returns {@code null} for invalid level names.
>  */
> @Plugin(name = "Level", category = CATEGORY)
> public static class LevelConverter implements TypeConverter<Level> {
>     @Override
>     public Level convert(final String s) {
>         return Level.valueOf(s);
>     }
> } {code}
> But {{Level.valueOf(s)}} throws an IllegalArgumentException for unknown levels.
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)