bbende commented on code in PR #6012:
URL: https://github.com/apache/nifi/pull/6012#discussion_r865970235
##########
nifi-registry/nifi-registry-core/nifi-registry-framework/src/main/java/org/apache/nifi/registry/provider/flow/git/GitFlowMetaData.java:
##########
@@ -522,7 +524,8 @@ void commit(String author, String message, Bucket bucket,
Flow.FlowPointer flowP
byte[] getContent(String objectId) throws IOException {
final ObjectId flowSnapshotObjectId = gitRepo.resolve(objectId);
- return gitRepo.newObjectReader().open(flowSnapshotObjectId).getBytes();
+ final ObjectStream objStream =
gitRepo.newObjectReader().open(flowSnapshotObjectId).openStream();
+ return IOUtils.toByteArray(objStream);
Review Comment:
Thanks for the info! I saw this comment in the code that you linked to
```
@return true if this object is too large to obtain as a byte array.
* Objects over a certain threshold should be accessed only by
their
* {@link #openStream()} to prevent overflowing the JVM heap.
```
So seems like that is the right approach. We could possibly call `isLarge()`
to determine which way to load the bytes, but I'm not sure if there is a real
advantage to that.
--
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]