Skip to content

Commit

Permalink
Merge pull request #1166 from xuwei-k/java-net-URL-constructor
Browse files Browse the repository at this point in the history
avoid deprecated `java.net.URL` constructor
  • Loading branch information
fthomas authored Mar 25, 2023
2 parents d83b4e4 + c2e361f commit cf28a14
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ object string extends StringInference {

object Url {
implicit def urlValidate: Validate.Plain[String, Url] =
Validate.fromPartial(new java.net.URL(_), "Url", Url())
Validate.fromPartial(new java.net.URI(_).toURL, "Url", Url())
}

object Uuid {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ object string extends StringInference {

object Url {
implicit def urlValidate: Validate.Plain[String, Url] =
Validate.fromPartial(new java.net.URL(_), "Url", Url())
Validate.fromPartial(new java.net.URI(_).toURL, "Url", Url())
}

object Uuid {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object string {

/** Creates a `java.net.URL` from a validated string. */
def url(s: String Refined Url): java.net.URL =
new java.net.URL(s.value)
new java.net.URI(s.value).toURL

/** Creates a `java.net.UUID` from a validated string. */
def uuid(s: String Refined Uuid): java.util.UUID =
Expand Down

0 comments on commit cf28a14

Please sign in to comment.