<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    On 24/01/2023 06:14, Aayush Atharva wrote:<br>
    <blockquote type="cite" cite="mid:MA0PR01MB67621781CA60331DD477E26CCDC99@MA0PR01MB6762.INDPRD01.PROD.OUTLOOK.COM">
      
      <style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255);" class="elementToProof ContentPasted0 ContentPasted1">
        Hello JDK Community! <span id="🙂">🙂</span></div>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255);" class="elementToProof ContentPasted0 ContentPasted1">
        <br>
      </div>
      <div style="font-family: Calibri, Arial, Helvetica, sans-serif;
        font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255,
        255, 255);" class="elementToProof ContentPasted0 ContentPasted1">
        The current ClosedChannelException does not have any
        constructors to pass a message. We have to rely on
        'initCause(...)'​ for passing extra messages regarding
        a ClosedChannelException but it's not a very good practice in my
        opinion. Because we will have to generate another Exception
        which will create another brand-new object in the heap and
        generates a stack trace. And all of this just to pass a simple
        message for ClosedChannelException.</div>
       <br>
    </blockquote>
    Can you bring this to nio-dev to discuss? Most of the exceptions
    that JSR-51 defined in that package are very specific. In this case,
    ClosedChannelException just means the channel is closed. Its
    subclasses AsynchronousCloseException and ClosedByInterruptException
    are for the more specific cases. Adding new constructors with
    messages/causes to support other usages might be okay but it
    shouldn't be done in isolation without creating an inconsistency in
    that package so it would have to looked at in the whole.<br>
    <br>
    -Alan.<br>
    <br>
  </body>
</html>