bson 4.9.3-java → 4.9.4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/bson-ruby.jar +0 -0
- data/lib/bson/array.rb +3 -0
- data/lib/bson/error.rb +6 -0
- data/lib/bson/hash.rb +3 -0
- data/lib/bson/version.rb +1 -1
- data/spec/bson/array_spec.rb +17 -0
- data/spec/bson/hash_spec.rb +17 -0
- metadata +91 -92
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eedbe4346e9f1ededbe02d7ce67e4e078c415caaa4b5e17fc1504a194ea48b3b
|
4
|
+
data.tar.gz: 0c3dbcdc8aa4593631b43e8df5db90b12fbf63ec5b3bcd85388f5c440a939eeb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd040870d55f7e7021ebe5d89a8737fe877f21bbfd8d96893d4c7972c312bedded6c787d67fe4647e241be84966ef9749de13b259416bbe9622ecc2de883a5a6
|
7
|
+
data.tar.gz: 7d595857065631624cf580220d8b0c83590e050a6c0bdfd420a886a18fac8ceb1a54702521aab6f3352d2de341e39059ea0ac372ebed7a7b410b80207e8445ff
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/bson-ruby.jar
CHANGED
Binary file
|
data/lib/bson/array.rb
CHANGED
@@ -47,6 +47,9 @@ module BSON
|
|
47
47
|
position = buffer.length
|
48
48
|
buffer.put_int32(0)
|
49
49
|
each_with_index do |value, index|
|
50
|
+
unless value.respond_to?(:bson_type)
|
51
|
+
raise Error::UnserializableClass, "Array element at position #{index} does not define its BSON serialized type: #{value}"
|
52
|
+
end
|
50
53
|
buffer.put_byte(value.bson_type)
|
51
54
|
buffer.put_cstring(index.to_s)
|
52
55
|
value.to_bson(buffer, validating_keys)
|
data/lib/bson/error.rb
CHANGED
@@ -17,5 +17,11 @@ module BSON
|
|
17
17
|
# Exception raised when BSON decoding fails.
|
18
18
|
class BSONDecodeError < Error
|
19
19
|
end
|
20
|
+
|
21
|
+
# Exception raised when serializing an Array or Hash to BSON and an
|
22
|
+
# array or hash element is of a class that does not define how to serialize
|
23
|
+
# itself to BSON.
|
24
|
+
class UnserializableClass < Error
|
25
|
+
end
|
20
26
|
end
|
21
27
|
end
|
data/lib/bson/hash.rb
CHANGED
@@ -44,6 +44,9 @@ module BSON
|
|
44
44
|
position = buffer.length
|
45
45
|
buffer.put_int32(0)
|
46
46
|
each do |field, value|
|
47
|
+
unless value.respond_to?(:bson_type)
|
48
|
+
raise Error::UnserializableClass, "Hash value for key '#{field}' does not define its BSON serialized type: #{value}"
|
49
|
+
end
|
47
50
|
buffer.put_byte(value.bson_type)
|
48
51
|
key = field.to_bson_key(validating_keys)
|
49
52
|
begin
|
data/lib/bson/version.rb
CHANGED
data/spec/bson/array_spec.rb
CHANGED
@@ -132,6 +132,23 @@ describe Array do
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
end
|
135
|
+
|
136
|
+
context 'when array contains value of an unserializable class' do
|
137
|
+
class ArraySpecUnserializableClass
|
138
|
+
end
|
139
|
+
|
140
|
+
let(:obj) do
|
141
|
+
[ArraySpecUnserializableClass.new]
|
142
|
+
end
|
143
|
+
|
144
|
+
it 'raises UnserializableClass' do
|
145
|
+
lambda do
|
146
|
+
obj.to_bson
|
147
|
+
end.should raise_error(BSON::Error::UnserializableClass,
|
148
|
+
# C extension does not provide element position in the exception message.
|
149
|
+
/(Array element at position 0|Value) does not define its BSON serialized type:.*ArraySpecUnserializableClass/)
|
150
|
+
end
|
151
|
+
end
|
135
152
|
end
|
136
153
|
|
137
154
|
describe "#to_bson_normalized_value" do
|
data/spec/bson/hash_spec.rb
CHANGED
@@ -227,6 +227,23 @@ describe Hash do
|
|
227
227
|
end
|
228
228
|
end
|
229
229
|
end
|
230
|
+
|
231
|
+
context 'when hash contains value of an unserializable class' do
|
232
|
+
class HashSpecUnserializableClass
|
233
|
+
end
|
234
|
+
|
235
|
+
let(:obj) do
|
236
|
+
{foo: HashSpecUnserializableClass.new}
|
237
|
+
end
|
238
|
+
|
239
|
+
it 'raises UnserializableClass' do
|
240
|
+
lambda do
|
241
|
+
obj.to_bson
|
242
|
+
end.should raise_error(BSON::Error::UnserializableClass,
|
243
|
+
# C extension does not provide hash key in the exception message.
|
244
|
+
/(Hash value for key 'foo'|Value) does not define its BSON serialized type:.*HashSpecUnserializableClass/)
|
245
|
+
end
|
246
|
+
end
|
230
247
|
end
|
231
248
|
|
232
249
|
describe '#to_bson' do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bson
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.9.
|
4
|
+
version: 4.9.4
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Tyler Brock
|
@@ -33,7 +33,7 @@ cert_chain:
|
|
33
33
|
gpvfPNWMwyBDlHaNS3GfO6cRRxBOvEG05GUCsvtTY4Bpe8yjE64wg1ymb47LMOnv
|
34
34
|
Qb1lGORmf/opg45mluKUYl7pQNZHD0d3
|
35
35
|
-----END CERTIFICATE-----
|
36
|
-
date: 2020-06-
|
36
|
+
date: 2020-06-29 00:00:00.000000000 Z
|
37
37
|
dependencies: []
|
38
38
|
description: A fully featured BSON specification implementation in Ruby
|
39
39
|
email:
|
@@ -223,119 +223,118 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
- !ruby/object:Gem::Version
|
224
224
|
version: 1.3.6
|
225
225
|
requirements: []
|
226
|
-
|
227
|
-
rubygems_version: 2.7.10
|
226
|
+
rubygems_version: 3.0.6
|
228
227
|
signing_key:
|
229
228
|
specification_version: 4
|
230
229
|
summary: Ruby implementation of the BSON specification
|
231
230
|
test_files:
|
232
231
|
- spec/spec_helper.rb
|
233
232
|
- spec/bson_spec.rb
|
234
|
-
- spec/bson/regexp_spec.rb
|
235
|
-
- spec/bson/min_key_spec.rb
|
236
|
-
- spec/bson/time_spec.rb
|
237
|
-
- spec/bson/int32_spec.rb
|
238
|
-
- spec/bson/code_spec.rb
|
239
|
-
- spec/bson/config_spec.rb
|
240
|
-
- spec/bson/undefined_spec.rb
|
241
|
-
- spec/bson/boolean_spec.rb
|
242
|
-
- spec/bson/object_spec.rb
|
243
|
-
- spec/bson/array_spec.rb
|
244
|
-
- spec/bson/hash_spec.rb
|
245
|
-
- spec/bson/date_spec.rb
|
246
|
-
- spec/bson/json_spec.rb
|
247
|
-
- spec/bson/time_with_zone_spec.rb
|
248
|
-
- spec/bson/int64_spec.rb
|
249
|
-
- spec/bson/registry_spec.rb
|
250
|
-
- spec/bson/binary_uuid_spec.rb
|
251
|
-
- spec/bson/byte_buffer_read_spec.rb
|
252
|
-
- spec/bson/raw_spec.rb
|
253
|
-
- spec/bson/binary_spec.rb
|
254
|
-
- spec/bson/max_key_spec.rb
|
255
|
-
- spec/bson/symbol_raw_spec.rb
|
256
|
-
- spec/bson/code_with_scope_spec.rb
|
257
|
-
- spec/bson/byte_buffer_write_spec.rb
|
258
|
-
- spec/bson/date_time_spec.rb
|
259
|
-
- spec/bson/false_class_spec.rb
|
260
|
-
- spec/bson/byte_buffer_spec.rb
|
261
|
-
- spec/bson/string_spec.rb
|
262
|
-
- spec/bson/open_struct_spec.rb
|
263
|
-
- spec/bson/timestamp_spec.rb
|
264
|
-
- spec/bson/ext_json_parse_spec.rb
|
265
|
-
- spec/bson/symbol_spec.rb
|
266
|
-
- spec/bson/decimal128_spec.rb
|
267
|
-
- spec/bson/integer_spec.rb
|
268
|
-
- spec/bson/document_spec.rb
|
269
|
-
- spec/bson/float_spec.rb
|
270
|
-
- spec/bson/nil_class_spec.rb
|
271
|
-
- spec/bson/true_class_spec.rb
|
272
|
-
- spec/bson/object_id_spec.rb
|
273
|
-
- spec/support/utils.rb
|
274
|
-
- spec/support/spec_config.rb
|
275
|
-
- spec/support/shared_examples.rb
|
276
|
-
- spec/runners/corpus.rb
|
277
|
-
- spec/runners/corpus_legacy.rb
|
278
|
-
- spec/runners/common_driver.rb
|
279
233
|
- spec/spec_tests/corpus_spec.rb
|
280
234
|
- spec/spec_tests/common_driver_spec.rb
|
281
235
|
- spec/spec_tests/corpus_legacy_spec.rb
|
236
|
+
- spec/spec_tests/data/corpus/decimal128-7.json
|
237
|
+
- spec/spec_tests/data/corpus/top.json
|
238
|
+
- spec/spec_tests/data/corpus/array.json
|
239
|
+
- spec/spec_tests/data/corpus/null.json
|
240
|
+
- spec/spec_tests/data/corpus/document.json
|
241
|
+
- spec/spec_tests/data/corpus/decimal128-2.json
|
242
|
+
- spec/spec_tests/data/corpus/decimal128-6.json
|
243
|
+
- spec/spec_tests/data/corpus/boolean.json
|
244
|
+
- spec/spec_tests/data/corpus/README.md
|
245
|
+
- spec/spec_tests/data/corpus/maxkey.json
|
246
|
+
- spec/spec_tests/data/corpus/binary.json
|
282
247
|
- spec/spec_tests/data/corpus/multi-type.json
|
283
|
-
- spec/spec_tests/data/corpus/
|
284
|
-
- spec/spec_tests/data/corpus/dbref.json
|
248
|
+
- spec/spec_tests/data/corpus/timestamp.json
|
285
249
|
- spec/spec_tests/data/corpus/multi-type-deprecated.json
|
286
|
-
- spec/spec_tests/data/corpus/
|
287
|
-
- spec/spec_tests/data/corpus/boolean.json
|
288
|
-
- spec/spec_tests/data/corpus/datetime.json
|
250
|
+
- spec/spec_tests/data/corpus/dbpointer.json
|
289
251
|
- spec/spec_tests/data/corpus/oid.json
|
290
|
-
- spec/spec_tests/data/corpus/
|
291
|
-
- spec/spec_tests/data/corpus/
|
292
|
-
- spec/spec_tests/data/corpus/decimal128-7.json
|
252
|
+
- spec/spec_tests/data/corpus/regex.json
|
253
|
+
- spec/spec_tests/data/corpus/minkey.json
|
293
254
|
- spec/spec_tests/data/corpus/symbol.json
|
255
|
+
- spec/spec_tests/data/corpus/dbref.json
|
256
|
+
- spec/spec_tests/data/corpus/decimal128-1.json
|
257
|
+
- spec/spec_tests/data/corpus/undefined.json
|
294
258
|
- spec/spec_tests/data/corpus/double.json
|
295
|
-
- spec/spec_tests/data/corpus/decimal128-6.json
|
296
|
-
- spec/spec_tests/data/corpus/code_w_scope.json
|
297
|
-
- spec/spec_tests/data/corpus/int64.json
|
298
|
-
- spec/spec_tests/data/corpus/README.md
|
299
|
-
- spec/spec_tests/data/corpus/string.json
|
300
|
-
- spec/spec_tests/data/corpus/document.json
|
301
|
-
- spec/spec_tests/data/corpus/decimal128-5.json
|
302
|
-
- spec/spec_tests/data/corpus/top.json
|
303
259
|
- spec/spec_tests/data/corpus/decimal128-4.json
|
304
|
-
- spec/spec_tests/data/corpus/null.json
|
305
|
-
- spec/spec_tests/data/corpus/int32.json
|
306
|
-
- spec/spec_tests/data/corpus/dbpointer.json
|
307
|
-
- spec/spec_tests/data/corpus/undefined.json
|
308
|
-
- spec/spec_tests/data/corpus/timestamp.json
|
309
260
|
- spec/spec_tests/data/corpus/decimal128-3.json
|
310
|
-
- spec/spec_tests/data/corpus/
|
311
|
-
- spec/spec_tests/data/corpus/
|
312
|
-
- spec/spec_tests/data/corpus/
|
313
|
-
- spec/spec_tests/data/corpus/
|
314
|
-
- spec/spec_tests/data/
|
315
|
-
- spec/spec_tests/data/
|
316
|
-
- spec/spec_tests/data/
|
317
|
-
- spec/spec_tests/data/corpus_legacy/code.json
|
318
|
-
- spec/spec_tests/data/corpus_legacy/array.json
|
319
|
-
- spec/spec_tests/data/corpus_legacy/double.json
|
320
|
-
- spec/spec_tests/data/corpus_legacy/code_w_scope.json
|
321
|
-
- spec/spec_tests/data/corpus_legacy/string.json
|
322
|
-
- spec/spec_tests/data/corpus_legacy/document.json
|
261
|
+
- spec/spec_tests/data/corpus/decimal128-5.json
|
262
|
+
- spec/spec_tests/data/corpus/int32.json
|
263
|
+
- spec/spec_tests/data/corpus/string.json
|
264
|
+
- spec/spec_tests/data/corpus/code.json
|
265
|
+
- spec/spec_tests/data/corpus/code_w_scope.json
|
266
|
+
- spec/spec_tests/data/corpus/int64.json
|
267
|
+
- spec/spec_tests/data/corpus/datetime.json
|
323
268
|
- spec/spec_tests/data/corpus_legacy/top.json
|
269
|
+
- spec/spec_tests/data/corpus_legacy/array.json
|
324
270
|
- spec/spec_tests/data/corpus_legacy/null.json
|
325
|
-
- spec/spec_tests/data/corpus_legacy/
|
326
|
-
- spec/spec_tests/data/corpus_legacy/
|
327
|
-
- spec/spec_tests/data/corpus_legacy/
|
271
|
+
- spec/spec_tests/data/corpus_legacy/document.json
|
272
|
+
- spec/spec_tests/data/corpus_legacy/boolean.json
|
273
|
+
- spec/spec_tests/data/corpus_legacy/maxkey.json
|
328
274
|
- spec/spec_tests/data/corpus_legacy/binary.json
|
329
|
-
- spec/spec_tests/data/corpus_legacy/
|
275
|
+
- spec/spec_tests/data/corpus_legacy/timestamp.json
|
276
|
+
- spec/spec_tests/data/corpus_legacy/oid.json
|
330
277
|
- spec/spec_tests/data/corpus_legacy/regex.json
|
331
|
-
- spec/spec_tests/data/corpus_legacy/
|
278
|
+
- spec/spec_tests/data/corpus_legacy/minkey.json
|
279
|
+
- spec/spec_tests/data/corpus_legacy/undefined.json
|
280
|
+
- spec/spec_tests/data/corpus_legacy/double.json
|
281
|
+
- spec/spec_tests/data/corpus_legacy/int32.json
|
282
|
+
- spec/spec_tests/data/corpus_legacy/string.json
|
283
|
+
- spec/spec_tests/data/corpus_legacy/code.json
|
284
|
+
- spec/spec_tests/data/corpus_legacy/code_w_scope.json
|
285
|
+
- spec/spec_tests/data/corpus_legacy/failures/dbpointer.json
|
332
286
|
- spec/spec_tests/data/corpus_legacy/failures/symbol.json
|
333
287
|
- spec/spec_tests/data/corpus_legacy/failures/int64.json
|
334
|
-
- spec/spec_tests/data/corpus_legacy/failures/
|
335
|
-
- spec/spec_tests/data/decimal128/decimal128-1.json
|
288
|
+
- spec/spec_tests/data/corpus_legacy/failures/datetime.json
|
336
289
|
- spec/spec_tests/data/decimal128/decimal128-7.json
|
290
|
+
- spec/spec_tests/data/decimal128/decimal128-2.json
|
337
291
|
- spec/spec_tests/data/decimal128/decimal128-6.json
|
338
|
-
- spec/spec_tests/data/decimal128/decimal128-
|
292
|
+
- spec/spec_tests/data/decimal128/decimal128-1.json
|
339
293
|
- spec/spec_tests/data/decimal128/decimal128-4.json
|
340
294
|
- spec/spec_tests/data/decimal128/decimal128-3.json
|
341
|
-
- spec/spec_tests/data/decimal128/decimal128-
|
295
|
+
- spec/spec_tests/data/decimal128/decimal128-5.json
|
296
|
+
- spec/support/utils.rb
|
297
|
+
- spec/support/shared_examples.rb
|
298
|
+
- spec/support/spec_config.rb
|
299
|
+
- spec/runners/common_driver.rb
|
300
|
+
- spec/runners/corpus_legacy.rb
|
301
|
+
- spec/runners/corpus.rb
|
302
|
+
- spec/bson/code_spec.rb
|
303
|
+
- spec/bson/byte_buffer_read_spec.rb
|
304
|
+
- spec/bson/int32_spec.rb
|
305
|
+
- spec/bson/max_key_spec.rb
|
306
|
+
- spec/bson/time_spec.rb
|
307
|
+
- spec/bson/array_spec.rb
|
308
|
+
- spec/bson/date_time_spec.rb
|
309
|
+
- spec/bson/document_spec.rb
|
310
|
+
- spec/bson/float_spec.rb
|
311
|
+
- spec/bson/nil_class_spec.rb
|
312
|
+
- spec/bson/time_with_zone_spec.rb
|
313
|
+
- spec/bson/ext_json_parse_spec.rb
|
314
|
+
- spec/bson/string_spec.rb
|
315
|
+
- spec/bson/open_struct_spec.rb
|
316
|
+
- spec/bson/config_spec.rb
|
317
|
+
- spec/bson/false_class_spec.rb
|
318
|
+
- spec/bson/raw_spec.rb
|
319
|
+
- spec/bson/regexp_spec.rb
|
320
|
+
- spec/bson/binary_spec.rb
|
321
|
+
- spec/bson/object_spec.rb
|
322
|
+
- spec/bson/decimal128_spec.rb
|
323
|
+
- spec/bson/binary_uuid_spec.rb
|
324
|
+
- spec/bson/boolean_spec.rb
|
325
|
+
- spec/bson/byte_buffer_spec.rb
|
326
|
+
- spec/bson/json_spec.rb
|
327
|
+
- spec/bson/symbol_spec.rb
|
328
|
+
- spec/bson/integer_spec.rb
|
329
|
+
- spec/bson/byte_buffer_write_spec.rb
|
330
|
+
- spec/bson/registry_spec.rb
|
331
|
+
- spec/bson/code_with_scope_spec.rb
|
332
|
+
- spec/bson/true_class_spec.rb
|
333
|
+
- spec/bson/undefined_spec.rb
|
334
|
+
- spec/bson/object_id_spec.rb
|
335
|
+
- spec/bson/timestamp_spec.rb
|
336
|
+
- spec/bson/hash_spec.rb
|
337
|
+
- spec/bson/symbol_raw_spec.rb
|
338
|
+
- spec/bson/min_key_spec.rb
|
339
|
+
- spec/bson/int64_spec.rb
|
340
|
+
- spec/bson/date_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|