Skip to content

Commit

Permalink
[bugfix][lib][rdbms] Fix NullPointerException when password is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
wgzhao committed Oct 10, 2024
1 parent bcf76c9 commit 3334246
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ public static void doPretreatment(Configuration originalConfig, DataBaseType dat
// 检查 username 配置(必填)
originalConfig.getNecessaryValue(Key.USERNAME, REQUIRED_VALUE);
String pass = originalConfig.getString(Key.PASSWORD, null);
if (pass.startsWith(Constant.ENC_PASSWORD_PREFIX)) {
if (pass != null && pass.startsWith(Constant.ENC_PASSWORD_PREFIX)) {
// encrypted password, need to decrypt
String decryptPassword = EncryptUtil.decrypt(pass.substring(6, pass.length() - 1));
String decryptPassword = EncryptUtil.decrypt(
pass.substring(Constant.ENC_PASSWORD_PREFIX.length(), pass.length() - 1)
);
originalConfig.set(Key.PASSWORD, decryptPassword);
}

Expand Down

0 comments on commit 3334246

Please sign in to comment.