Skip to content

Commit

Permalink
TEIIDDES-2164: Corrected field validation logic.
Browse files Browse the repository at this point in the history
* Also added check for null or empty string when validating the security type. This is equivalent to "None".
  • Loading branch information
blafond committed Jul 15, 2014
1 parent 969281a commit 95df7f3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,36 @@ protected void validate() {
if (null == urlText.getText() || urlText.getText().isEmpty()) {
errorMessage = UTIL.getString("Common.URL.Error.Message"); //$NON-NLS-1$
valid = false;
setErrorMessage(errorMessage);
setValid(valid);
return;
}
if (!SecurityType.None.name().equals(securityText.getText()) &&
//An empty or null security type value is treated the same as "None"
String securityType = securityText.getText();
if (securityType!=null && (!securityType.trim().equals(StringUtilities.EMPTY_STRING) &&
!SecurityType.None.name().equals(securityType)) &&
!SecurityType.HTTPBasic.name().equals(securityText.getText())) {
errorMessage = UTIL.getString("Common.Security.Error.Message"); //$NON-NLS-1$
valid = false;
setErrorMessage(errorMessage);
setValid(valid);
return;
}
if (!SecurityType.None.name().equals(securityText.getText())) {
if (securityType!=null && !securityType.trim().equals(StringUtilities.EMPTY_STRING) &&
(!SecurityType.None.name().equals(securityType))) {
if (null == passwordText.getText() || passwordText.getText().isEmpty()) {
errorMessage = UTIL.getString("Common.Password.Error.Message"); //$NON-NLS-1$
valid = false;
setErrorMessage(errorMessage);
setValid(valid);
return;
}
if (null == usernameText.getText() || usernameText.getText().isEmpty()) {
errorMessage = UTIL.getString("Common.Username.Error.Message"); //$NON-NLS-1$
valid = false;
setErrorMessage(errorMessage);
setValid(valid);
return;
}
}
setErrorMessage(errorMessage);
Expand Down Expand Up @@ -315,7 +331,7 @@ protected Properties collectProperties() {
result = new Properties();
}
result.setProperty(IWSProfileConstants.END_POINT_URI_PROP_ID, urlText.getText());
result.setProperty(ICredentialsCommon.SECURITY_TYPE_ID, securityText.getText());
result.setProperty(ICredentialsCommon.SECURITY_TYPE_ID, securityText.getText().trim());
result.setProperty(ICredentialsCommon.USERNAME_PROP_ID, usernameText.getText());
result.setProperty(ICredentialsCommon.PASSWORD_PROP_ID, passwordText.getText());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Common.URL.Error.Message=The Connection URL cannot be empty
Common.URL.Invalid.Message=The URL is not valid:
Common.URLorFILE.Invalid.Message=The URL is not valid or the File does not exist.
Common.Context.Factory.Error.Message=The Context Factory cannot be empty
Common.Security.Error.Message=None, HTTPBasic, and WSSecurity are the only valid values for Security Type
Common.Security.Error.Message=None and HTTPBasic are the only valid values for Security Type
Common.EndPoint.Error.Message=The WSDL EndPoint cannot be empty
Common.EndPointName.Error.Message=The WSDL EndPoint cannot be empty
Common.EndPointBinding.Error.Message=The WSDL EndPoint Binding Type cannot be empty
Expand Down

0 comments on commit 95df7f3

Please sign in to comment.