remove usages of new URL() as constructor is deprecated on jdk 20+ (#5219)

This commit is contained in:
Chris Stewart 2023-08-31 10:45:16 -05:00 committed by GitHub
parent 3ae41032a4
commit c6524b9246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ object JsonReaders {
implicit object URLReads extends Reads[URL] {
override def reads(json: JsValue): JsResult[URL] =
SerializerUtil.processJsString[URL](str => new URL(str))(json)
SerializerUtil.processJsString[URL](str => new URI(str).toURL)(json)
}
implicit object ZonedDateTimeReads extends Reads[ZonedDateTime] {

View File

@ -5,7 +5,7 @@ import org.bitcoins.core.util._
import org.bitcoins.crypto.StringFactory
import scodec.bits.ByteVector
import java.net.URL
import java.net.{URI, URL}
import scala.util.{Failure, Success, Try}
class LnURL private (private val str: String) {
@ -13,7 +13,7 @@ class LnURL private (private val str: String) {
val url: URL = LnURL.decode(str) match {
case Failure(_) =>
throw new IllegalArgumentException("Invalid LnURL encoding")
case Success(value) => new URL(value)
case Success(value) => new URI(value).toURL
}
override def toString: String = str.toUpperCase