[JAVA-228] when saving file with gridfs, if the size is aligned with 256KB, then driver saves an extra chunk at the end with empty array Created: 08/Dec/10  Updated: 22/Dec/10  Resolved: 09/Dec/10

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 2.4

Type: Bug Priority: Major - P3
Reporter: Antoine Girbal Assignee: Antoine Girbal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

in GridFSInputFile.java, the loop creating chunks only ends when:
...
if ( start < b.length )
break;
...

But it should also check if total == file length.
Right now it does an extra loop.



 Comments   
Comment by auto [ 09/Dec/10 ]

Author:

{'login': 'agirbal', 'name': 'agirbal', 'email': 'antoine@10gen.com'}

Message: JAVA-229: when saving file with gridfs and using a custom chunksize, it is not properly set on the parent file object, and fetching object later on will break

JAVA-228: when saving file with gridfs, if the size is aligned with 256KB, then driver saves an extra chunk at the end with empty array

Misc:

  • ability to choose chunkSize before obtaining and OutputStream
  • fix to previous commit: do not save file object in saveChunks()
  • prevent mixed use of inputStream / outputStream in GridFSInputFile
  • better comments on functions
  • added test for writing a gridfs file of a size aligned with chunkSize
    /mongodb/mongo-java-driver/commit/55387702a05246122da6e91491cc04c4daeb0894
Generated at Thu Feb 08 08:51:47 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.