Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JWT007 opened this issue Jan 6, 2025 · 1 comment

Comments

@JWT007
Copy link
Contributor

JWT007 commented Jan 6, 2025

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.

@JWT007
Copy link
Contributor Author

JWT007 commented Feb 11, 2025

Hi @ppkarwasz - another PR - this one should be an easy one :)

JWT007 pushed a commit to JWT007/logging-log4j2 that referenced this issue Feb 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant