[slf4j-dev] [JIRA] Updates for SLF4J-557: MDCCloseable: not a great fit for a try-with-resources statement

QOS.CH (JIRA) noreply-jira at qos.ch
Sun Sep 25 16:48:00 CEST 2022


SLF4J / SLF4J-557 [In Progress]
MDCCloseable: not a great fit for a try-with-resources statement

==============================

Here's what changed in this issue in the last few minutes.

There is 1 comment.

View or comment on issue using this link
https://jira.qos.ch/browse/SLF4J-557

==============================
 1 comment
------------------------------

Ceki Gülcü on 25/Sep/22 4:33 PM

The following test fails...
{code:java}
 public void closableTestA() {
        String key = "key-" + 1199;
        String val = "val-" + 1199;

        try (MDC.MDCCloseable closeable = MDC.putCloseable(key, val)) {
            if (1 == 1)
                throw new IllegalStateException("foo");
        } catch (IllegalStateException e) {
            assertNotNull(MDC.get(key));
            assertEquals(val, MDC.get(key));
        } finally {
        }
        assertNull(MDC.get(key));
    }
{code}


==============================
 This message was sent by Atlassian Jira (v8.8.0#808000-sha1:e2c7e59)



More information about the slf4j-dev mailing list