Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-4908

Ensure no NPE is thrown with SerializedFluxSink

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 4.9.1
    • None
    • None
    • None
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

    Description

      From PR: https://github.com/mongodb/mongo-java-driver/pull/1096

      Hi there,

      We use Mongodb reactive stream driver with akka-stream and had an issue when trying to upgrade our mongodb driver from 4.1.x to 4.9.0. The same code which was working with 4.1.x does not work anymore with 4.9.0.
      We tracked downed the issue and it's happening since the addition of reactor to this project.

      The issue is that when performing a find/distinct which returns null values, when the results are used in a SerializedFluxSink a NullPointerException is thrown and everything stops. This is because SerializedFluxSink.next performs a call to Object.requireNonNull().

      To fix this NPE we filter out null values from the results.

      I'm not sure this is the appropriate way to test/fix, suggestions are welcome.
      In the meantime we workaround this on our side by filtering out null values in the query.

      Thanks

      Attachments

        Activity

          People

            ross@mongodb.com Ross Lawley
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: