To produce the exception:
Mongo mongo = new Mongo("localhost", 27017);
GridFS gfs = new GridFS(mongo.getDB("bucket_test"));
GridFSInputFile file = gfs.createFile("512kb_bucket");
file.setChunkSize(512 * 1024);
OutputStream os = file.getOutputStream();
for (int i=0; i<32 * 1024 * 1024; i++)
os.close();
mongo.close();
It appears that the private _buffer[] in GridFSInputFile.java should be resized as well in the setChunkSize(long _chunkSize) method. Eg.
—
public void setChunkSize(long _chunkSize)
—