Skip to content

Commit

Permalink
Scala Common Enrich: bump scala-uri to 0.5.0 (closes #2893)
Browse files Browse the repository at this point in the history
  • Loading branch information
BenFradet committed Aug 25, 2017
1 parent 1126ad8 commit a7460d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions 3-enrich/scala-common-enrich/project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ object Dependencies {
val scalaWeather = "0.3.0"
val scalaj = "2.3.0"
val gatlingJsonpath = "0.6.4"
val scalaUri = "0.5.0"
// Scala (test only)
val specs2 = "2.3.13"
val scalazSpecs2 = "0.2"
val scalaCheck = "1.10.0"
val scalaUri = "0.4.3"
val scaldingArgs = "0.13.0"
val mockito = "1.10.19"
}
Expand Down Expand Up @@ -92,7 +92,7 @@ object Dependencies {
val json4sJackson = "org.json4s" %% "json4s-jackson" % V.json4s
val json4sScalaz = "org.json4s" %% "json4s-scalaz" % V.json4s
val igluClient = "com.snowplowanalytics" %% "iglu-scala-client" % V.igluClient
val scalaUri = "com.netaporter" %% "scala-uri" % V.scalaUri
val scalaUri = "io.lemonlabs" %% "scala-uri" % V.scalaUri
val scalaWeather = "com.snowplowanalytics" %% "scala-weather" % V.scalaWeather
val scalaj = "org.scalaj" %% "scalaj-http" % V.scalaj
val gatlingJsonpath = "io.gatling" %% "jsonpath" % V.gatlingJsonpath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -356,16 +356,15 @@ object ConversionUtils {
* @param encoding Encoding of the URI
*/
def extractQuerystring(uri: URI, encoding: String): Validation[String, Map[String, String]] =
try {
URLEncodedUtils.parse(uri, encoding).map(p => (p.getName -> p.getValue)).toMap.success
} catch {
case NonFatal(e1) => try {
Uri.parse(uri.toString).query.params.toMap.success
} catch {
case NonFatal(e2) =>
s"Could not parse uri [$uri]. Apache Httpclient threw exception: [$e1]. Net-a-porter threw exception: [$e2]".fail
Try(URLEncodedUtils.parse(uri, encoding).map(p => (p.getName -> p.getValue)))
.recoverWith {
case NonFatal(_) =>
Try(Uri.parse(uri.toString).query.params)
.map(l => l.map(t => (t._1, t._2.getOrElse(""))))
} match {
case util.Success(s) => s.toMap.success
case util.Failure(e) => s"Could not parse uri [$uri]. Uri parsing threw exception: [$e].".fail
}
}

/**
* Extract a Scala Int from
Expand Down

0 comments on commit a7460d8

Please sign in to comment.