File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
src/main/com/mongodb/gridfs Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -67,11 +67,16 @@ public void validate() throws MongoException {
67
67
DBObject cmd = new BasicDBObject ( "filemd5" , _id );
68
68
cmd .put ( "root" , _fs ._bucketName );
69
69
DBObject res = _fs ._db .command ( cmd );
70
- String m = res .get ( "md5" ).toString ();
71
- if ( m .equals ( _md5 ) )
72
- return ;
70
+ if ( res != null && res .containsField ( "md5" ) ) {
71
+ String m = res .get ( "md5" ).toString ();
72
+ if ( m .equals ( _md5 ) )
73
+ return ;
74
+ throw new MongoException ( "md5 differ. mine [" + _md5 + "] theirs [" + m + "]" );
75
+ }
76
+
77
+ // no md5 from the server
78
+ throw new MongoException ( "no md5 returned from server: " + res );
73
79
74
- throw new MongoException ( "md5 differ. mine [" + _md5 + "] theirs [" + m + "]" );
75
80
}
76
81
77
82
/**
You can’t perform that action at this time.
0 commit comments