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

Wrong exception is thrown when mongocrypt_ctx_new fails

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.11.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      I think createDecryptionContext, createDataKeyContext, createExplicitEncryptionContext, and createExplicitDecryptionContext throw the wrong exception when mongocrypt_ctx_new fails:

              mongocrypt_ctx_t context = mongocrypt_ctx_new(wrapped);
              if (context == null) {
                  MongoCryptContextImpl.throwExceptionFromStatus(context);
              }
      

      https://github.com/mongodb/libmongocrypt/blob/1.0.0-beta2/bindings/java/mongocrypt/src/main/java/com/mongodb/crypt/capi/MongoCryptImpl.java#L153

      Should be:

              mongocrypt_ctx_t context = mongocrypt_ctx_new(wrapped);
              if (context == null) {
                  throwExceptionFromStatus();
              }
      

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: