Commit e2671f05 authored by Bill Wang's avatar Bill Wang
Browse files

improve credential error case handling

parent b72b1c76
...@@ -66,8 +66,11 @@ public class ElasticSettingServiceImpl implements IElasticSettingService { ...@@ -66,8 +66,11 @@ public class ElasticSettingServiceImpl implements IElasticSettingService {
host = provider.getParameterAsString(hostParameter); host = provider.getParameterAsString(hostParameter);
port = Integer.parseInt(provider.getParameterAsString(portParameter)); port = Integer.parseInt(provider.getParameterAsString(portParameter));
Map<String, String>val = provider.getCredentialsAsMap("elasticsearch_credentials"); Map<String, String>val = provider.getCredentialsAsMap("elasticsearch_credentials");
username = val.getOrDefault("username", username); if (val != null){
password = val.getOrDefault("password", password); username = val.get("username");
password = val.get("password");
}
//elastic expects username:password format //elastic expects username:password format
usernameAndPassword = String.format("%s:%s", username, password); usernameAndPassword = String.format("%s:%s", username, password);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment