[ 
https://issues.apache.org/jira/browse/HADOOP-19118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17828517#comment-17828517
 ] 

Steve Loughran commented on HADOOP-19118:
-----------------------------------------

if e.e.getLocalizedMessage() is null it should fall back to e.toString()

> 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ó
>            Priority: Major
>
> There is an issue in specific Ranger versions (where RANGER-3989 is not 
> fixed) 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-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to