[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] [Resolved] (IO-729) BrokenReader, BrokenWriter, BrokenInputStream, BrokenOutputStream can cau
From:       "Gary D. Gregory (Jira)" <jira () apache ! org>
Date:       2021-09-28 20:06:01
Message-ID: JIRA.13369481.1617540887000.1072459.1632859561287 () Atlassian ! JIRA
[Download RAW message or body]


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

Gary D. Gregory resolved IO-729.
--------------------------------
    Resolution: Fixed

In git master, please verify and close.

> BrokenReader, BrokenWriter, BrokenInputStream, BrokenOutputStream can cause \
>                 IllegalArgumentException in combination with try-with-resources
> -------------------------------------------------------------------------------------------------------------------------------------------
>  
> Key: IO-729
> URL: https://issues.apache.org/jira/browse/IO-729
> Project: Commons IO
> Issue Type: Bug
> Components: Streams/Writers
> Affects Versions: 2.8.0
> Reporter: Rob Spoor
> Priority: Minor
> Fix For: 2.12.0
> 
> 
> The following little code snippet can cause an IllegalArgumentException with \
> message "Self-suppression not permitted": {code}        try (Writer writer = new \
> BrokenWriter()) { writer.write('a');
> }{code}
> The try-with-resources mechanism will try to add the exception thrown from \
> {{close}} as suppress exception to the exception thrown from {{write}}. Since those \
> are the same, an exception is thrown. From the source of java.lang.Throwable: \
> {code}    public final synchronized void addSuppressed(Throwable exception) { if \
> (exception == this) throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE, \
> exception);{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic