1 2 Previous Next 20 Replies Latest reply on Nov 8, 2012 6:45 PM by jpalka Go to original post
      • 15. Re: EOFException with clustered Modeshape3
        jpalka

        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

          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

            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

              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

                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

                  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.

                  1 2 Previous Next