Éamonn McManus created IO-866:
---------------------------------

             Summary: Recent change to AbstractByteArrayOutputStream breaks 
source compatibility
                 Key: IO-866
                 URL: https://issues.apache.org/jira/browse/IO-866
             Project: Commons IO
          Issue Type: Bug
          Components: Streams/Writers
            Reporter: Éamonn McManus


A [recent 
change|https://github.com/apache/commons-io/commit/b1c3d9d676c39512b7bbe9a02af57bfb2ef3dd15]
 to AbstractByteArrayOutputStream introduced an override of 
`OutputStream.write(byte[])` which removes the `throws IOException` clause from 
the inherited method. That means it is not source-compatible, since Java code 
that calls the method inside a try/catch will no longer compile unless 
something else in the try/catch also throws IOException. This affects at least 
two other Apache projects:
 * Apache POI 
[here|https://github.com/apache/poi/blob/3f4e7189b3190e796d1748fb308849cae0797ec8/poi/src/main/java/org/apache/poi/hssf/record/EscherAggregate.java#L1041]
 * Apache XML Graphics Commons 
[here|https://github.com/apache/xmlgraphics-commons/blob/b662464628a89bee30334bd133ab6387937aa182/src/main/java/org/apache/xmlgraphics/image/loader/impl/ImageLoaderRawJPEG.java#L230]

It's obviously a bit annoying to force client code to catch `IOException` when 
it can't actually be thrown, but that's how it was before this change so the 
`throws` clause should probably be reinstated.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to