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

Wrong exception is thrown when mongocrypt_ctx_new fails

    XMLWordPrintable

    Details

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

      Description

      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();
              }
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: