Description
In the instance when a keystore cannot be opened, DefaultKeystoreService returns null rather than provide any appropriate diagnostics.
Specific usecase: On suse - gateway run with sun jdk and keystores created with same.
Try to provision a credential with knoxcli running with an IBM jdk and we get a NPE:
java.lang.NullPointerException
at org.apache.hadoop.gateway.services.security.impl.BaseKeystoreService.writeKeystoreToFile(BaseKeystoreService.java:225)
at org.apache.hadoop.gateway.services.security.impl.DefaultKeystoreService.addCredentialForCluster(DefaultKeystoreService.java:202)
at org.apache.hadoop.gateway.services.security.impl.DefaultAliasService.addAliasForCluster(DefaultAliasService.java:119)
at org.apache.hadoop.gateway.util.KnoxCLI$AliasCreateCommand.execute(KnoxCLI.java:414)
at org.apache.hadoop.gateway.util.KnoxCLI.run(KnoxCLI.java:94)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
at org.apache.hadoop.gateway.util.KnoxCLI.main(KnoxCLI.java:649)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.hadoop.gateway.launcher.Invoker.invokeMainMethod(Invoker.java:70)
at org.apache.hadoop.gateway.launcher.Invoker.invoke(Invoker.java:39)
at org.apache.hadoop.gateway.launcher.Command.run(Command.java:101)
at org.apache.hadoop.gateway.launcher.Launcher.run(Launcher.java:69)
at org.apache.hadoop.gateway.launcher.Launcher.main(Launcher.java:46)