[ 
https://issues.apache.org/jira/browse/IO-866?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17937641#comment-17937641
 ] 

Gary D. Gregory commented on IO-866:
------------------------------------

Hello [~eamonnmcmanus] 

Thank you for the additional feedback.

We can revert to the old implementation if need be, but this does not solve the 
issue of fixing {{{}FileChannels.contentEquals(){}}}.

If you can find a better way to implement {{{}FileChannels.contentEquals(){}}}, 
feel free to provide it :)

So for now, I'll incorporate this new test and see how to fix that method.

 

> 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
>            Priority: Major
>
> 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