Dénes Bodó created HADOOP-19118:
-----------------------------------

             Summary: KeyShell fails with NPE when KMS throws Exception with 
null as message
                 Key: HADOOP-19118
                 URL: https://issues.apache.org/jira/browse/HADOOP-19118
             Project: Hadoop Common
          Issue Type: Bug
          Components: common, crypto
    Affects Versions: 3.3.6
            Reporter: Dénes Bodó


There is an issue in specific Ranger version where RANGER-3989 which throws 
Exception in case of concurrent access to a HashMap with Message {*}null{*}.
{noformat}
java.util.ConcurrentModificationException: null
        at java.util.HashMap$HashIterator.nextNode(HashMap.java:1469)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1503)
        at java.util.HashMap$EntryIterator.next(HashMap.java:1501) {noformat}
This manifests in Hadoop's KeyShell as an Exception with message {*}null{*}.

So when
{code:java}
  private String prettifyException(Exception e) {
    return e.getClass().getSimpleName() + ": " +
        e.getLocalizedMessage().split("\n")[0];
  } {code}
tries to print out the Exception the user experiences NPE
{noformat}
Exception in thread "main" java.lang.NullPointerException
        at 
org.apache.hadoop.crypto.key.KeyShell.prettifyException(KeyShell.java:541)
        at 
org.apache.hadoop.crypto.key.KeyShell.printException(KeyShell.java:536)
        at org.apache.hadoop.tools.CommandShell.run(CommandShell.java:79)
        at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:81)
        at org.apache.hadoop.crypto.key.KeyShell.main(KeyShell.java:553) 
{noformat}
This is an unwanted behaviour because the user does not have any feedback what 
and where went wrong.

 

My suggestion is to add *null checking* into the affected *prettifyException* 
method.

I'll create the Github PR soon.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-dev-h...@hadoop.apache.org

Reply via email to