Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-2067

FileDataStore: only open a stream when really necessary

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.6
    • jackrabbit-core
    • None

    Description

      Currently, PropertyImpl.getValue() opens a FileInputStream if the FileDataStore is used.
      If the application doesn't use the value, this stream is never closed.

      PropertyImpl.getValue():
      return internalGetValue().toJCRValue(session);
      InternalValue.toJCRValue(..):
      case PropertyType.BINARY:
      return new BinaryValue(((BLOBFileValue) val).getStream());
      BLOBInDataStore.getStream():
      return getDataRecord().getStream();
      FileDataRecord.getStream():
      return new FileInputStream(file);

      One solution is to return a 'lazy' file input stream that only opens the file when reading from the stream (and closing the file when the last byte was read). Maybe there is already a class (in Apache Commons maybe?) that can do that.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            thomasm Thomas Mueller
            thomasm Thomas Mueller
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment