Added support for dash/underscore in custom URLs

This commit is contained in:
Pablo Fernandez committed 2010-10-14 14:19:53 -03:00
1 parent ffb1042146
commit 91c64ff08b
2 files changed
+3 -3

No files matched your search

@@ -7,7 +7,7 @@ import org.scribe.model.OAuthConstants;
public class Preconditions
{
private static final String DEFAULT_MESSAGE = "Received an invalid parameter";
private static final Pattern URL_PATTERN = Pattern.compile("[a-zA-Z]+://\\S+");
private static final Pattern URL_PATTERN = Pattern.compile("[a-zA-Z_-]+://\\S+");
public static void checkNotNull(Object object, String errorMsg)
{
@@ -55,13 +55,13 @@ public class PreconditionsTest
public void shouldAllowNonStandarProtocolsForAndroid()
{
Preconditions.checkValidUrl("myUrl://www.example.com", ERROR_MSG);
Preconditions.checkValidUrl("x-url-custom://www.example.com", ERROR_MSG);
}
@Test(expected = IllegalArgumentException.class)
public void shouldNotAllowStrangeProtocolNames()
{
Preconditions.checkValidUrl("_weird*://www.example.com", ERROR_MSG);
Preconditions.checkValidUrl("$weird*://www.example.com", ERROR_MSG);
}
public void shouldAllowOutOfBandAsValidCallbackValue()