Skip to content

Commit

Permalink
[JBIDE-22596] disable domain validation to cope with *.cdk urls (#1223)
Browse files Browse the repository at this point in the history
Signed-off-by: Fred Bricon <fbricon@gmail.com>
  • Loading branch information
fbricon committed Jun 13, 2016
1 parent 72c82bc commit 8f0e64b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
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

0 comments on commit 8f0e64b

Please sign in to comment.