Reamer commented on a change in pull request #3718: [ZEPPELIN-4727] Fix HDFS
Credentials storage
URL: https://github.com/apache/zeppelin/pull/3718#discussion_r405361030
##########
File path:
zeppelin-zengine/src/main/java/org/apache/zeppelin/user/Credentials.java
##########
@@ -80,7 +73,22 @@ public Credentials(Boolean credentialsPersist, String
credentialsPath, String en
}
}
+ /**
+ * Wrapper for inmemory user credentials.
+ *
+ * @param conf
+ * @throws IOException
+ */
+ public Credentials() {
+ credentialsMap = new HashMap<>();
+ credentialsPersist = false;
+ encryptor = null;
+ storage = null;
+ gson = null;
+ }
+
public UserCredentials getUserCredentials(String username) {
+ loadCredentials();
Review comment:
No `loadCredentials` doesn't throw IOException. IOException is catched in
`loadFromFile`
```
private void loadCredentials() {
if (credentialsPersist) {
loadFromFile();
}
}
private void loadFromFile() {
try {
String json = storage.loadCredentials();
if (encryptor != null) {
json = encryptor.decrypt(json);
}
CredentialsInfoSaving info = CredentialsInfoSaving.fromJson(json);
if (info != null) {
this.credentialsMap = info.credentialsMap;
}
} catch (IOException e) {
LOG.error("Error loading credentials file", e);
}
}
```
I found out, that `saveToFile` catches also the IOException. Should we throw
the IOException in both cases for a correct handling in
[`CredentialRestApi`](https://github.com/apache/zeppelin/blob/ec16666bc4704842df0941cc7aee6ed441562e6f/zeppelin-server/src/main/java/org/apache/zeppelin/rest/CredentialRestApi.java#L85-L86)?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services