rzo1 commented on code in PR #596:
URL: https://github.com/apache/opennlp/pull/596#discussion_r1564855870
##########
opennlp-tools/src/main/java/opennlp/tools/ml/maxent/RealBasicEventStream.java:
##########
@@ -49,13 +55,14 @@ public Event read() throws IOException {
}
private Event createEvent(String obs) {
- int lastSpace = obs.lastIndexOf(' ');
- if (lastSpace == -1)
+ int si = obs.indexOf(' ');
+ if (si == 0)
Review Comment:
Shouldn't that be `-1` ? Otherwise, it might produce an index out of bound
exception in the else branch (because nothing prevents the caller to just
insert `bla` as an element in the event stream (alhough it does not comply with
the text format).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]