@@ -162,9 +162,10 @@ public ObjectId store(InputStream content, String filename, String contentType,
162
162
163
163
Assert .notNull (content , "InputStream must not be null!" );
164
164
165
- GridFSUploadOptions opts = new GridFSUploadOptions ();
165
+ GridFSUploadOptions options = new GridFSUploadOptions ();
166
166
167
167
Document mData = new Document ();
168
+
168
169
if (StringUtils .hasText (contentType )) {
169
170
mData .put (GridFsResource .CONTENT_TYPE_FIELD , contentType );
170
171
}
@@ -173,9 +174,9 @@ public ObjectId store(InputStream content, String filename, String contentType,
173
174
mData .putAll (metadata );
174
175
}
175
176
176
- opts .metadata (mData );
177
+ options .metadata (mData );
177
178
178
- return getGridFs ().uploadFromStream (filename , content , opts );
179
+ return getGridFs ().uploadFromStream (filename , content , options );
179
180
}
180
181
181
182
/*
@@ -228,7 +229,7 @@ public ClassLoader getClassLoader() {
228
229
public GridFsResource getResource (String location ) {
229
230
230
231
GridFSFile file = findOne (query (whereFilename ().is (location )));
231
- return file != null ? new GridFsResource (file , getGridFs ().openDownloadStreamByName (location )) : null ;
232
+ return file != null ? new GridFsResource (file , getGridFs ().openDownloadStream (location )) : null ;
232
233
}
233
234
234
235
/*
@@ -249,7 +250,7 @@ public GridFsResource[] getResources(String locationPattern) {
249
250
List <GridFsResource > resources = new ArrayList <GridFsResource >();
250
251
251
252
for (GridFSFile file : files ) {
252
- resources .add (new GridFsResource (file , getGridFs ().openDownloadStreamByName (file .getFilename ())));
253
+ resources .add (new GridFsResource (file , getGridFs ().openDownloadStream (file .getFilename ())));
253
254
}
254
255
255
256
return resources .toArray (new GridFsResource [resources .size ()]);
@@ -258,10 +259,6 @@ public GridFsResource[] getResources(String locationPattern) {
258
259
return new GridFsResource [] { getResource (locationPattern ) };
259
260
}
260
261
261
- private Document getMappedQuery (Query query ) {
262
- return query == null ? new Query ().getQueryObject () : getMappedQuery (query .getQueryObject ());
263
- }
264
-
265
262
private Document getMappedQuery (Document query ) {
266
263
return query == null ? null : queryMapper .getMappedObject (query , Optional .empty ());
267
264
}
0 commit comments