You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2021/03/11 06:12:17 UTC
[zeppelin] branch branch-0.9 updated: [ZEPPELIN-5192]: Don't try to
decrypt a non-existent credentials file
This is an automated email from the ASF dual-hosted git repository.
zjffdu pushed a commit to branch branch-0.9
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/branch-0.9 by this push:
new b7aba7f [ZEPPELIN-5192]: Don't try to decrypt a non-existent credentials file
b7aba7f is described below
commit b7aba7fce27f6e3151c671f70e794f7136f04634
Author: Niels Grewe <ni...@zasta.de>
AuthorDate: Sat Feb 27 00:03:53 2021 +0100
[ZEPPELIN-5192]: Don't try to decrypt a non-existent credentials file
### What is this PR for?
This is a very simple fix for the issue described in [ZEPPELIN-5192](https://issues.apache.org/jira/browse/ZEPPELIN-5192): Zeppelin will currently fail to start if a credentials encryption key is configured but no `credentials.json` file exists currently. This is due to an NPE inside the decryption code path. The fix is to only attempt the decryption if the file could be loaded.
### What type of PR is it?
[Bug Fix]
### What is the Jira issue?
* [ZEPPELIN-5192](https://issues.apache.org/jira/browse/ZEPPELIN-5192)
### How should this be tested?
Booting a fresh Zeppelin server with ZEPPELIN_CREDENTIALS_ENCRYPT_KEY set is sufficient to reproduce the issue and validate the fix.
Author: Niels Grewe <ni...@zasta.de>
Closes #4062 from ngrewe/bugfix/ZEPPELIN-5192 and squashes the following commits:
6dd974358 [Niels Grewe] fix(ZEPPELIN-5192): Don't try to decrypt a non-existent credentials file
(cherry picked from commit 704f2b9d31678e5561be47e6466eb23bd0b5e9e7)
Signed-off-by: Jeff Zhang <zj...@apache.org>
---
.../src/main/java/org/apache/zeppelin/user/Credentials.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java
index 867d79e..df69853 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java
@@ -137,7 +137,7 @@ public class Credentials {
private void loadFromFile() throws IOException {
try {
String json = storage.loadCredentials();
- if (encryptor != null) {
+ if (json != null && encryptor != null) {
json = encryptor.decrypt(json);
}