DS-2952: Only prepend new line if we have an actual input stream

This commit is contained in:
Tom Desair
2016-12-30 00:43:53 +01:00
parent df1f81bf9d
commit c50c3006dd

View File

@@ -189,9 +189,9 @@ public class FullTextContentStreams extends ContentStreamBase
} }
public InputStream nextElement() { public InputStream nextElement() {
InputStream inputStream; InputStream inputStream = null;
FullTextBitstream bitstream = null; FullTextBitstream bitstream = null;
try { try {
bitstream = fulltextIterator.next(); bitstream = fulltextIterator.next();
inputStream = bitstream.getInputStream(); inputStream = bitstream.getInputStream();
@@ -203,7 +203,8 @@ public class FullTextContentStreams extends ContentStreamBase
inputStream = new ByteArrayInputStream((e.getClass() + ": " + e.getMessage()).getBytes(StandardCharsets.UTF_8)); inputStream = new ByteArrayInputStream((e.getClass() + ": " + e.getMessage()).getBytes(StandardCharsets.UTF_8));
} }
return new SequenceInputStream(new ByteArrayInputStream("\n".getBytes(Charsets.UTF_8)), inputStream); return inputStream == null ? null : new SequenceInputStream(
new ByteArrayInputStream("\n".getBytes(Charsets.UTF_8)), inputStream);
} }
} }