File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
main/scala/com/salesforce/op/features/types
test/scala/com/salesforce/op/features/types Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,8 @@ import com.twitter.chill.Base64.{InputStream => Base64InputStream}
3838import org .apache .commons .io .input .CharSequenceInputStream
3939import org .apache .commons .validator .routines .UrlValidator
4040
41+ import scala .util .Try
42+
4143/**
4244 * Text value representation
4345 *
@@ -171,7 +173,7 @@ class URL(value: Option[String]) extends Text(value){
171173 * RFC2396 (http://www.ietf.org/rfc/rfc2396.txt)
172174 * Default valid protocols are: http, https, ftp.
173175 */
174- def isValid : Boolean = value.exists(UrlValidator .getInstance().isValid)
176+ def isValid : Boolean = value.exists(v => UrlValidator .getInstance().isValid(v) && Try ( new java.net. URL (v)).isSuccess )
175177 /**
176178 * Verifies if the url is of correct form of "Uniform Resource Identifiers (URI): Generic Syntax"
177179 * RFC2396 (http://www.ietf.org/rfc/rfc2396.txt)
Original file line number Diff line number Diff line change @@ -48,7 +48,8 @@ class URLTest extends PropSpec with PropertyChecks with TestCommon {
4848 Some (" ftp://.codomain" ),
4949 Some (" https://.codomain" ),
5050 Some (" //domain.nambia" ),
51- Some (" http://\u00ff\u0080\u007f\u0000 .com" ) // scalastyle:off
51+ Some (" http://\u00ff\u0080\u007f\u0000 .com" ), // scalastyle:off
52+ Some (" http://specialchars.@.com" )
5253 )
5354
5455 val goodOnes = Table (" good ones" ,
You can’t perform that action at this time.
0 commit comments