Richard Zowalla created OPENNLP-1949:
----------------------------------------

             Summary: ADSentenceStream.read() loops forever on an empty 
sentence at end of file
                 Key: OPENNLP-1949
                 URL: https://issues.apache.org/jira/browse/OPENNLP-1949
             Project: OpenNLP
          Issue Type: Bug
            Reporter: Richard Zowalla


{{ADSentenceStream.read\(\)}} \(lines 481\-531\): at EOF with {{sentenceStarted 
== true}} and an empty buffer, neither branch returns, so the {{while 
\(true\)}} loop calls {{samples.read\(\)}} forever.

_Repro:_
{code:java}
new ADSentenceStream\(ObjectStreamUtils.createObjectStream\(""\)\).read\(\); // 
never returns
{code}
Verified: still running after 3 s.

A truncated or damaged Arvores Deitadas file hangs training instead of failing.

_Fix:_ return {{null}} \(or throw {{InvalidFormatException}} naming the 
unclosed sentence\) when EOF is reached with an empty started sentence, and add 
a test.





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

Reply via email to