Skip to content

Commit

Permalink
FORGE-2028: Connection Profile Password is no longer required
Browse files Browse the repository at this point in the history
HSQLDB does not require a password.
  • Loading branch information
gastaldi committed Sep 22, 2014
1 parent 05f70d1 commit 541ac34
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void initializeUI(UIBuilder builder) throws Exception
connectionProfile.setValueChoices(profileNames);
connectionProfile.setValue("");
// Enable password input only if profile does not store saved passwords
Callable<Boolean> enablePasswordInput = new Callable<Boolean>()
connectionProfilePassword.setEnabled(new Callable<Boolean>()
{
@Override
public Boolean call() throws Exception
Expand All @@ -106,8 +106,7 @@ public Boolean call() throws Exception
ConnectionProfile profile = profiles.get(connectionProfileName);
return !profile.isSavePassword();
}
};
connectionProfilePassword.setEnabled(enablePasswordInput).setRequired(enablePasswordInput);
});
builder.add(targetPackage).add(connectionProfile).add(connectionProfilePassword);
}

Expand Down Expand Up @@ -170,15 +169,18 @@ private Properties createConnectionProperties(ConnectionProfile profile)
result.setProperty("hibernate.dialect",
profile.getDialect() == null ? "" : profile.getDialect());
String profilePassword;
// If password is not saved, user must supply it
// If password is not saved, user must provide it
if (profile.isSavePassword())
{
profilePassword = profile.getPassword() == null ? "" : profile.getPassword();
profilePassword = profile.getPassword();
}
else
{
profilePassword = connectionProfilePassword.getValue();
}
if (profilePassword == null)
profilePassword = "";

result.setProperty("hibernate.connection.password", profilePassword);
result.setProperty("hibernate.connection.url",
profile.getUrl() == null ? "" : profile.getUrl());
Expand Down

0 comments on commit 541ac34

Please sign in to comment.