Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JBIDE-22596] disable domain validation to cope with *.cdk urls #1223

Merged
merged 1 commit into from Jun 13, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -28,7 +28,15 @@ public class URLValidator implements IValidator{
private static final String [] SCHEMES = new String [] {"http", "https"};
private final String invalidURLMessage;
private boolean allowEmpty = false;
private UrlValidator validator = new UrlValidator(SCHEMES, UrlValidator.ALLOW_LOCAL_URLS);
@SuppressWarnings("serial")
private UrlValidator validator = new UrlValidator(SCHEMES, UrlValidator.ALLOW_LOCAL_URLS) {
protected boolean isValidAuthority(String domain) {
//default implementation doesn't recognize *.cdk domains as valid authorities
//so we bypass that check altogether. An alternative would be to provide a RegexValidator,
//but to use what regexp?
return true;
};
};

/**
* @param urlType The value to plug into error message of 'Please provide a valid TYPE URL'
Expand Down
Expand Up @@ -24,7 +24,13 @@ public class URLValidatorTest {
public void testHttpsPassValidURL() {
assertEquals(ValidationStatus.ok(), validator.validate("https://foobar"));
}


@Test
public void testCdkDomainValidURL() {
assertEquals(ValidationStatus.ok(),
validator.validate("https://openshift.cdk"));
}

@Test
public void testHttpPassValidURL() {
assertEquals(ValidationStatus.ok(), validator.validate("http://foobar"));
Expand Down