BytesReference usage to properly work when hasArray is not available

fix spelling in comment, + remove overcautious assert
This commit is contained in:
Shay Banon 2014-03-18 21:06:04 +01:00
parent 0f6c24d0c5
commit 1f15c1e7de
2 changed files with 1 additions and 2 deletions

View File

@ -344,7 +344,6 @@ public class SourceFieldMapper extends AbstractFieldMapper<byte[]> implements In
if (!source.hasArray()) { if (!source.hasArray()) {
source = source.toBytesArray(); source = source.toBytesArray();
} }
assert source.hasArray();
fields.add(new StoredField(names().indexName(), source.array(), source.arrayOffset(), source.length())); fields.add(new StoredField(names().indexName(), source.array(), source.arrayOffset(), source.length()));
} }

View File

@ -350,7 +350,7 @@ public class FsTranslog extends AbstractIndexShardComponent implements Translog
out.seek(size); out.seek(size);
BytesReference ref = out.bytes(); BytesReference ref = out.bytes();
// TODO: pass teh BytesReference to the FsTranslogFile and have them optimize writing // TODO: pass the BytesReference to the FsTranslogFile and have them optimize writing
if (!ref.hasArray()) { if (!ref.hasArray()) {
ref = ref.toBytesArray(); ref = ref.toBytesArray();
} }