lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Vysny (JIRA)" <>
Subject [jira] [Created] (LUCENE-5855) BinaryDictionary may fail reading a file
Date Tue, 29 Jul 2014 15:27:39 GMT
Martin Vysny created LUCENE-5855:

             Summary: BinaryDictionary may fail reading a file
                 Key: LUCENE-5855
             Project: Lucene - Core
          Issue Type: Bug
          Components: modules/analysis
    Affects Versions: 4.9
            Reporter: Martin Vysny

The following code may fail on other JVMs, e.g. on Android:

      final ByteBuffer tmpBuffer = ByteBuffer.allocateDirect(size);
      final ReadableByteChannel channel = Channels.newChannel(dictIS);
      final int read =;
      if (read != size) {
        throw new EOFException("Cannot read whole dictionary");

The code expects that will fill entire buffer contents, which is however not
the case: may even decide to read 0 bytes and this mimicks
behavior. The current Lucene code accidentally works on Oracle Java because Oracle Java
fills the buffer fully (just check the Channels.newChannel() implementation).

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message