-
15. Re: EOFException with clustered Modeshape3
jpalka Nov 8, 2012 6:26 PM (in response to rhauch)What if we pass ArrayEditor to BsonWriter? BsonReader will return BasicDocument, I have attached test case to JIRA issue.
-
16. Re: EOFException with clustered Modeshape3
jpalka Nov 8, 2012 6:35 PM (in response to jpalka)My point is that somewhere in the code we pass ArrayEditor to BsonWriter, and we should have Document which has Array in it. Like in shouldRoundTripSimpleBsonObjectWithArray in a test case you were reffering to.
-
17. Re: EOFException with clustered Modeshape3
rhauch Nov 8, 2012 6:37 PM (in response to jpalka)What if we pass ArrayEditor to BsonWriter? BsonReader will return BasicDocument, I have attached test case to JIRA issue.
Perhaps I'm not seeing the big picture. What's the case where we'd pass an ArrayEditor object (or any Array instance) to BsonWriter.write(...)? I'll have to look at the BSON spec, but I don't recall that being an option.
-
18. Re: EOFException with clustered Modeshape3
rhauch Nov 8, 2012 6:41 PM (in response to rhauch)Randall Hauch wrote:
... I'll have to look at the BSON spec, but I don't recall that being an option.
According to my reading of the BSON specification, a BSON file always represents a document (not an array), because each "element" consists of a type code, a name (e.g., a field name), and the value.
-
19. Re: EOFException with clustered Modeshape3
rhauch Nov 8, 2012 6:43 PM (in response to jpalka)Jaroslaw Palka wrote:
My point is that somewhere in the code we pass ArrayEditor to BsonWriter, and we should have Document which has Array in it. Like in shouldRoundTripSimpleBsonObjectWithArray in a test case you were reffering to.
I think we need to track this down, because that's not correct. The Bson class (which is the only thing that should be used) is typed to only allow writing a Document; BsonWriter is really an implementation detail of the Bson.write methods.
-
20. Re: EOFException with clustered Modeshape3
jpalka Nov 8, 2012 6:45 PM (in response to rhauch)And you are right, Array (or ArrayEditor) is converted by BsonWriter to { "0" : "value0", "1" : "value1" }, so during read operation we get Document object not an Array, which ends up with ClassCastException during deserialization of ArrayEditor.