Skip to content

Javadoc: TypeConverters convert for "Level" incorrectly documents behaviour for invalid value #3359

Closed
@JWT007

Description

@JWT007

Log4j 2.24

Minor Javadoc correction.

In TypeConverters, the conversion for type "Level" says it returns 'null' for invalid levels:

/**
 * 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);
    }
} 

But Level.valueOf(s) throws an IllegalArgumentException for unknown levels.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions