dsmiley commented on code in PR #2669:
URL: https://github.com/apache/solr/pull/2669#discussion_r1731593824
##########
solr/core/src/java/org/apache/solr/handler/designer/DefaultSampleDocumentsLoader.java:
##########
@@ -65,14 +64,11 @@ public class DefaultSampleDocumentsLoader implements
SampleDocumentsLoader {
private static final int MAX_STREAM_SIZE = (5 * 1024 * 1024);
private static final Logger log =
LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
- public static byte[] streamAsBytes(final InputStream in) throws IOException {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- byte[] buf = new byte[1024];
- int r;
+ /** Reads input completely into a byte array. Closes the stream. */
Review Comment:
Yes; it's unusual for a method to accept an InputStream and also close it.
I at least documented it. And I reduced its scope from public. I was tempted
to rename the method to something like streamAsBytesAndClose so that the
closing is super apparent at the caller. Can still do.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]