aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Warski <adam@warski.org>2017-12-30 10:42:21 +0100
committerGitHub <noreply@github.com>2017-12-30 10:42:21 +0100
commitfb417152b290d3e826154ffbaadb856abeb71b77 (patch)
tree6d81d83ff1ef3466e3bc0b349defe50d53b55b13
parent0a6ed5d2d5e59accf96dc1f5ca33725e27f7df91 (diff)
parent990f29cf744011f411e424edb53d99be2ba3ec18 (diff)
downloadsttp-fb417152b290d3e826154ffbaadb856abeb71b77.tar.gz
sttp-fb417152b290d3e826154ffbaadb856abeb71b77.tar.bz2
sttp-fb417152b290d3e826154ffbaadb856abeb71b77.zip
Merge pull request #58 from joshlemer/remove-StringTokenizer
Remove dependence on StringTokenizer
-rw-r--r--core/src/main/scala/com/softwaremill/sttp/Response.scala13
1 files changed, 3 insertions, 10 deletions
diff --git a/core/src/main/scala/com/softwaremill/sttp/Response.scala b/core/src/main/scala/com/softwaremill/sttp/Response.scala
index 7551ee0..4d9c385 100644
--- a/core/src/main/scala/com/softwaremill/sttp/Response.scala
+++ b/core/src/main/scala/com/softwaremill/sttp/Response.scala
@@ -3,13 +3,7 @@ package com.softwaremill.sttp
import java.net.HttpCookie
import java.text.SimpleDateFormat
import java.time.ZonedDateTime
-import java.util.{
- Calendar,
- GregorianCalendar,
- Locale,
- StringTokenizer,
- TimeZone
-}
+import java.util.{Calendar, GregorianCalendar, Locale, TimeZone}
import scala.collection.JavaConverters._
import scala.collection.immutable.Seq
@@ -75,12 +69,11 @@ object Cookie {
// hand-parsing in such case to preserve the values from the cookie
val lch = h.toLowerCase
val (expires, maxAge) = if (lch.contains("expires=")) {
- val tokenizer = new StringTokenizer(h, ";")
+ val tokens = h.split(";")
var e: Option[ZonedDateTime] = None
var ma: Option[Long] = None
- while (tokenizer.hasMoreTokens) {
- val t = tokenizer.nextToken()
+ for (t <- tokens) {
val nv = t.split("=", 2)
if (nv(0).toLowerCase.contains("expires") && nv.length > 1) {
e = expiryDate2ZonedDateTime(nv(1).trim())