Vikas Kumar created RANGER-5337:
-----------------------------------

             Summary: Exception handling improvement in RangerMasterKey
                 Key: RANGER-5337
                 URL: https://issues.apache.org/jira/browse/RANGER-5337
             Project: Ranger
          Issue Type: New Feature
          Components: kms
            Reporter: Vikas Kumar
            Assignee: Vikas Kumar


In RangerKeyStoreProvider class, if MasterKey creation fails due to any runtime 
error, it only logs the exception message, not the stack trace.

Logging proper stack trace will help in identifying the root cause.

Example:

Tried to create MK with wrong salt size and got following  in the log:

 
{code:java}
2025-09-23 10:16:35,822 ERROR 
org.apache.hadoop.crypto.key.RangerKeyStoreProvider: [main]: createProvider() 
error
java.lang.RuntimeException: Error while generating Ranger Master key, Error - 
null
        at 
org.apache.hadoop.crypto.key.RangerKeyStoreProvider.generateAndGetMasterKey(RangerKeyStoreProvider.java:542)
 ~[ranger-kms-*.jar:?]
{code}
 

  Root Cause:
{code:java}
throw new RuntimeException("Error while getting Ranger Master key, Error - " + 
e.getMessage());{code}
 
Instead it should be :
{code:java}
throw new RuntimeException("Error while getting Ranger Master key.", e);{code}
      



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to