[jira] [Updated] (HDFS-6733) Creating encryption zone results in NPE when KeyProvider is null

2014-07-23 Thread Charles Lamb (JIRA)

 [ 
https://issues.apache.org/jira/browse/HDFS-6733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Charles Lamb updated HDFS-6733:
---

Attachment: HDFS-6733.002.patch

> Creating encryption zone results in NPE when KeyProvider is null
> 
>
> Key: HDFS-6733
> URL: https://issues.apache.org/jira/browse/HDFS-6733
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: security
>Affects Versions: fs-encryption (HADOOP-10150 and HDFS-6134)
>Reporter: Stephen Chu
>Assignee: Charles Lamb
> Attachments: HDFS-6733.001.patch, HDFS-6733.002.patch
>
>
> When users try to create an encryption zone on a system that is not 
> configured with a KeyProvider, they will run into a NullPointerException.
> For example:
> [hdfs@schu-enc2 ~]$ hdfs crypto -createZone -keyName abc123 -path /user/hdfs
> 2014-07-22 23:18:23,273 WARN  [main] crypto.CryptoCodec 
> (CryptoCodec.java:getInstance(70)) - Crypto codec 
> org.apache.hadoop.crypto.OpensslAesCtrCryptoCodec is not available.
> RemoteException: java.lang.NullPointerException
> This error happens in 
> FSNamesystem.createEncryptionZone(FSNamesystem.java:8456):
> {code}
> try {
>   if (keyName == null || keyName.isEmpty()) {
> keyName = UUID.randomUUID().toString();
> createNewKey(keyName, src);
> createdKey = true;
>   } else {
> KeyVersion keyVersion = provider.getCurrentKey(keyName);
> if (keyVersion == null) {
> {code}
> provider can be null.
> An improvement would be to make the error message more specific/say that 
> KeyProvider was not found.



--
This message was sent by Atlassian JIRA
(v6.2#6252)


[jira] [Updated] (HDFS-6733) Creating encryption zone results in NPE when KeyProvider is null

2014-07-22 Thread Charles Lamb (JIRA)

 [ 
https://issues.apache.org/jira/browse/HDFS-6733?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Charles Lamb updated HDFS-6733:
---

Attachment: HDFS-6733.001.patch

Here's a patch and a unit test. I thought about putting the unit test in 
TestEncryptionZone, but the @Before always configures a key provider so I just 
created a new Testxxx.java.

> Creating encryption zone results in NPE when KeyProvider is null
> 
>
> Key: HDFS-6733
> URL: https://issues.apache.org/jira/browse/HDFS-6733
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>  Components: security
>Affects Versions: fs-encryption (HADOOP-10150 and HDFS-6134)
>Reporter: Stephen Chu
>Assignee: Charles Lamb
> Attachments: HDFS-6733.001.patch
>
>
> When users try to create an encryption zone on a system that is not 
> configured with a KeyProvider, they will run into a NullPointerException.
> For example:
> [hdfs@schu-enc2 ~]$ hdfs crypto -createZone -keyName abc123 -path /user/hdfs
> 2014-07-22 23:18:23,273 WARN  [main] crypto.CryptoCodec 
> (CryptoCodec.java:getInstance(70)) - Crypto codec 
> org.apache.hadoop.crypto.OpensslAesCtrCryptoCodec is not available.
> RemoteException: java.lang.NullPointerException
> This error happens in 
> FSNamesystem.createEncryptionZone(FSNamesystem.java:8456):
> {code}
> try {
>   if (keyName == null || keyName.isEmpty()) {
> keyName = UUID.randomUUID().toString();
> createNewKey(keyName, src);
> createdKey = true;
>   } else {
> KeyVersion keyVersion = provider.getCurrentKey(keyName);
> if (keyVersion == null) {
> {code}
> provider can be null.
> An improvement would be to make the error message more specific/say that 
> KeyProvider was not found.



--
This message was sent by Atlassian JIRA
(v6.2#6252)