mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 23:28:42 +03:00
Merge pull request #3573 from nextcloud/crashOnLoginURL
Remove exception
This commit is contained in:
commit
ac4bcc7a72
2 changed files with 19 additions and 15 deletions
|
@ -573,9 +573,6 @@ public class AuthenticatorActivity extends AccountAuthenticatorActivity
|
|||
} else if (value.startsWith("server" + LOGIN_URL_DATA_KEY_VALUE_SEPARATOR)) {
|
||||
loginUrlInfo.serverAddress = URLDecoder.decode(
|
||||
value.substring(("server" + LOGIN_URL_DATA_KEY_VALUE_SEPARATOR).length()));
|
||||
} else {
|
||||
// error illegal URL element detected
|
||||
throw new IllegalArgumentException("Illegal magic login URL element detected: " + value);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
* Nextcloud Android client application
|
||||
*
|
||||
* @author Andy Scherzinger
|
||||
|
@ -157,17 +157,24 @@ public class AuthenticatorDataUrlTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void noDataUrlElements() {
|
||||
AuthenticatorActivity.parseLoginDataUrl(schemeUrl, "");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void tooLittleDataUrlElements() {
|
||||
for (String urlStart : urlStarts) {
|
||||
try {
|
||||
System.out.println(urlStart);
|
||||
AuthenticatorActivity.parseLoginDataUrl(urlStart, urlStart);
|
||||
Assert.fail("Illegal Argument Exception expected!");
|
||||
} catch (IllegalArgumentException e) {
|
||||
// all well
|
||||
System.out.println("Expected Illegal Argument Exception caught.");
|
||||
}
|
||||
}
|
||||
public void onlyOneDataUrlElements() {
|
||||
LoginUrlInfo loginUrlInfo = AuthenticatorActivity.parseLoginDataUrl(schemeUrl, schemeUrl + userUrlPart);
|
||||
|
||||
Assert.assertEquals(userValue, loginUrlInfo.username);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onlyTwoDataUrlElements() {
|
||||
LoginUrlInfo loginUrlInfo = AuthenticatorActivity.parseLoginDataUrl(schemeUrl, schemeUrl + userUrlPart +
|
||||
plus + addressUrlPart);
|
||||
|
||||
Assert.assertEquals(userValue, loginUrlInfo.username);
|
||||
Assert.assertEquals(addressValue, loginUrlInfo.serverAddress);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue