File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -50,4 +50,9 @@ module Constants
50
50
require 'mongo/gridfs/grid_ext'
51
51
require 'mongo/gridfs/grid'
52
52
require 'mongo/gridfs/grid_io'
53
+ if RUBY_PLATFORM =~ /java/
54
+ require 'mongo/gridfs/grid_io_fix'
55
+ end
53
56
require 'mongo/gridfs/grid_file_system'
57
+
58
+
Original file line number Diff line number Diff line change
1
+ # encoding: UTF-8
2
+
3
+ # --
4
+ # Copyright (C) 2008-2010 10gen Inc.
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ # ++
18
+
19
+ module Mongo
20
+ class GridIO
21
+
22
+ # This fixes a comparson issue in JRuby 1.9
23
+ def get_md5
24
+ md5_command = BSON ::OrderedHash . new
25
+ md5_command [ 'filemd5' ] = @files_id
26
+ md5_command [ 'root' ] = @fs_name
27
+ @server_md5 = @files . db . command ( md5_command ) [ 'md5' ]
28
+ if @safe
29
+ @client_md5 = @local_md5 . hexdigest
30
+ if @local_md5 . to_s != @server_md5 . to_s
31
+ raise GridMD5Failure , "File on server failed MD5 check"
32
+ end
33
+ else
34
+ @server_md5
35
+ end
36
+ end
37
+ end
38
+ end
You can’t perform that action at this time.
0 commit comments