You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Ulli Hafner (Jira)" <ji...@apache.org> on 2023/09/21 08:36:00 UTC
[jira] [Commented] (IO-803) ReaderInputStream fails with IllegalStateException on empty files
[ https://issues.apache.org/jira/browse/IO-803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17767460#comment-17767460 ]
Ulli Hafner commented on IO-803:
--------------------------------
It is now 3 months since this has been fixed. Can you please create a new release?
> ReaderInputStream fails with IllegalStateException on empty files
> -----------------------------------------------------------------
>
> Key: IO-803
> URL: https://issues.apache.org/jira/browse/IO-803
> Project: Commons IO
> Issue Type: Bug
> Components: Streams/Writers
> Affects Versions: 2.12.0, 2.13.0
> Reporter: Ulli Hafner
> Priority: Major
> Fix For: 2.14.0
>
>
> I have several test cases that check that my SAX parsers correctly handle empty files. Since the upgrade of commons-io from 2.11.0 to 2.12.0 these tests fail with the following exception:
> {noformat}
> java.lang.IllegalStateException: Current state = FLUSHED, new state = CODING_END
> at java.base/java.nio.charset.CharsetEncoder.throwIllegalStateException(CharsetEncoder.java:996)
> at java.base/java.nio.charset.CharsetEncoder.encode(CharsetEncoder.java:578)
> at org.apache.commons.io.input.ReaderInputStream.fillBuffer(ReaderInputStream.java:357)
> at org.apache.commons.io.input.ReaderInputStream.read(ReaderInputStream.java:388)
> at org.apache.xerces.impl.XMLEntityManager$RewindableInputStream.readAndBuffer(Unknown Source)
> at org.apache.xerces.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
> at org.apache.xerces.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
> at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
> at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
> at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
> at edu.hm.hafner.analysis.parser.ReaderTest.shouldThrowIoException(ReaderTest.java:24)
> {noformat}
> From my understanding the method {{ReaderInputStream.fillBuffer}} should silently handle empty streams (or throw an {{IOException}}).
> Here is a PR with a test case that exposes the bug: https://github.com/jenkinsci/analysis-model/pull/923/files
> Here is the associated failure in our CI:
> https://ci.jenkins.io/job/Plugins/job/analysis-model/job/PR-923/4/testReport/junit/edu.hm.hafner.analysis.parser/ReaderTest/linux_17___Build__linux_17____shouldThrowIoException/
--
This message was sent by Atlassian Jira
(v8.20.10#820010)