Skip to content

Commit

Permalink
Merge pull request #779 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
eed3si9n authored Mar 25, 2023
2 parents ad859c1 + b1de1d5 commit 7e56de9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/src/main/scala/giter8/MavenHelper.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@

package giter8

import java.net.{HttpURLConnection, URL}
import java.net.{HttpURLConnection, URI, URL}
import scala.xml.{NodeSeq, XML}

trait MavenHelper {
def fromMaven(org: String, name: String, getVersions: Boolean)(process: (String, NodeSeq) => VersionE): VersionE = {
val search = "https://search.maven.org/solrsearch/select"
val loc = s"""$search?q=g:%22$org%22+AND+a:%22$name%22&rows=10&wt=xml${if (getVersions) "&core=gav" else ""}"""

withHttp(new URL(loc)) { conn =>
withHttp(new URI(loc).toURL) { conn =>
conn.getResponseCode match {
case 200 =>
val elem = XML.load(conn.getInputStream)
Expand Down

0 comments on commit 7e56de9

Please sign in to comment.