ggershinsky commented on code in PR #3745:
URL: https://github.com/apache/parquet-java/pull/3745#discussion_r3855179575


##########
parquet-hadoop/src/main/java/org/apache/parquet/crypto/keytools/FileKeyUnwrapper.java:
##########
@@ -157,10 +157,13 @@ KeyToolkit.KmsClientAndDetails 
getKmsClientFromConfigOrKeyMaterial(KeyMaterial k
 
     String kmsInstanceURL = 
hadoopConfiguration.getTrimmed(KeyToolkit.KMS_INSTANCE_URL_PROPERTY_NAME);
     if (stringIsEmpty(kmsInstanceURL)) {
-      kmsInstanceURL = keyMaterial.getKmsInstanceURL();
+      if (hadoopConfiguration.getBoolean(
+          KeyToolkit.KMS_ENABLE_URL_READ_PROPERTY_NAME, 
KeyToolkit.KMS_ENABLE_URL_READ_DEFAULT)) {
+        kmsInstanceURL = keyMaterial.getKmsInstanceURL();
+      }
+
       if (null == kmsInstanceURL) {
-        throw new ParquetCryptoRuntimeException(
-            "KMS instance URL is missing both in properties and file key 
material");
+        kmsInstanceURL = KmsClient.KMS_INSTANCE_URL_DEFAULT;

Review Comment:
   This will prevent throwing an exception for most of the current users. 
Today, this exception is never thrown in practice, because the writer always 
fills the url value (set or default) in the key material, so the reader always 
gets something, either from properties or from the key material. Now that we 
skip reading the url from key material by default, the existing readers that 
don't use the property value, will get an exception. So to prevent it and to 
preserve the current interface, we drop the exception, and return the 
KMS_INSTANCE_URL_DEFAULT value (which is given to the readers today, from the 
key material).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to