You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/01/22 19:10:41 UTC

[GitHub] csantanapr closed pull request #3119: update commons-io to latest (2.6)

csantanapr closed pull request #3119: update commons-io to latest (2.6)
URL: https://github.com/apache/incubator-openwhisk/pull/3119
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/common/scala/build.gradle b/common/scala/build.gradle
index 8bd408f638..e8ed52a86c 100644
--- a/common/scala/build.gradle
+++ b/common/scala/build.gradle
@@ -27,7 +27,7 @@ dependencies {
     compile 'org.slf4j:jcl-over-slf4j:1.7.25'
     compile 'org.slf4j:log4j-over-slf4j:1.7.25'
     compile 'commons-codec:commons-codec:1.9'
-    compile 'commons-io:commons-io:2.4'
+    compile 'commons-io:commons-io:2.6'
     compile 'commons-collections:commons-collections:3.2.2'
     compile 'org.apache.kafka:kafka-clients:0.11.0.1'
     compile ('org.apache.httpcomponents:httpclient:4.4.1') {
diff --git a/tests/src/test/scala/common/rest/WskRest.scala b/tests/src/test/scala/common/rest/WskRest.scala
index 7c31deec4b..4934b8ec42 100644
--- a/tests/src/test/scala/common/rest/WskRest.scala
+++ b/tests/src/test/scala/common/rest/WskRest.scala
@@ -21,13 +21,11 @@ import java.io.File
 import java.time.Instant
 import java.util.Base64
 import java.security.cert.X509Certificate
-
 import org.apache.commons.io.FileUtils
 import org.scalatest.Matchers
 import org.scalatest.FlatSpec
 import org.scalatest.concurrent.ScalaFutures
 import org.scalatest.time.Span.convertDurationToSpan
-
 import scala.Left
 import scala.Right
 import scala.collection.JavaConversions.mapAsJavaMap
@@ -41,7 +39,6 @@ import scala.util.Failure
 import scala.util.Success
 import scala.util.Try
 import scala.util.{Failure, Success}
-
 import akka.http.scaladsl.model.StatusCode
 import akka.http.scaladsl.model.StatusCodes.Accepted
 import akka.http.scaladsl.model.StatusCodes.NotFound
@@ -63,17 +60,14 @@ import akka.http.scaladsl.model.HttpMethods.POST
 import akka.http.scaladsl.model.HttpMethods.PUT
 import akka.http.scaladsl.HttpsConnectionContext
 import akka.http.scaladsl.settings.ConnectionPoolSettings
-
 import akka.stream.ActorMaterializer
 import akka.stream.scaladsl.{Keep, Sink, Source}
 import akka.stream.{OverflowStrategy, QueueOfferResult}
-
 import spray.json._
 import spray.json.DefaultJsonProtocol._
 import spray.json.JsObject
 import spray.json.JsValue
 import spray.json.pimpString
-
 import common._
 import common.BaseDeleteFromCollection
 import common.BaseListOrGetFromCollection
@@ -89,13 +83,11 @@ import common.WaitFor
 import common.WhiskProperties
 import common.WskActorSystem
 import common.WskProps
-
 import whisk.core.entity.ByteSize
 import whisk.utils.retry
-
 import javax.net.ssl.{HostnameVerifier, KeyManager, SSLContext, SSLSession, X509TrustManager}
-
 import com.typesafe.sslconfig.akka.AkkaSSLConfig
+import java.nio.charset.StandardCharsets
 
 class AcceptAllHostNameVerifier extends HostnameVerifier {
   override def verify(s: String, sslSession: SSLSession): Boolean = true
@@ -278,16 +270,16 @@ class WskRestAction
             ("", Base64.getEncoder.encodeToString(zip), artifactFile)
           }
           case ".js" => {
-            ("nodejs:default", FileUtils.readFileToString(new File(artifactFile)), artifactFile)
+            ("nodejs:default", FileUtils.readFileToString(new File(artifactFile), StandardCharsets.UTF_8), artifactFile)
           }
           case ".py" => {
-            ("python:default", FileUtils.readFileToString(new File(artifactFile)), artifactFile)
+            ("python:default", FileUtils.readFileToString(new File(artifactFile), StandardCharsets.UTF_8), artifactFile)
           }
           case ".swift" => {
-            ("swift:default", FileUtils.readFileToString(new File(artifactFile)), artifactFile)
+            ("swift:default", FileUtils.readFileToString(new File(artifactFile), StandardCharsets.UTF_8), artifactFile)
           }
           case ".php" => {
-            ("php:default", FileUtils.readFileToString(new File(artifactFile)), artifactFile)
+            ("php:default", FileUtils.readFileToString(new File(artifactFile), StandardCharsets.UTF_8), artifactFile)
           }
           case _ => ("", "", artifactFile)
         }
@@ -530,7 +522,7 @@ class WskRestTrigger
                     expectedExitCode: Int = Accepted.intValue)(implicit wp: WskProps): RestResult = {
     val path = getNamePath(noun, name)
     val params = parameterFile map { l =>
-      val input = FileUtils.readFileToString(new File(l))
+      val input = FileUtils.readFileToString(new File(l), StandardCharsets.UTF_8)
       input.parseJson.convertTo[Map[String, JsValue]]
     } getOrElse parameters
     val resp =
@@ -1019,7 +1011,7 @@ class WskRestApi extends RunWskRestCmd with BaseApi {
           } getOrElse Map[String, JsValue]()
         } ++ {
           swagger map { s =>
-            val swaggerFile = FileUtils.readFileToString(new File(s))
+            val swaggerFile = FileUtils.readFileToString(new File(s), StandardCharsets.UTF_8)
             Map("swagger" -> swaggerFile.toJson)
           } getOrElse Map[String, JsValue]()
         }
@@ -1050,7 +1042,7 @@ class WskRestApi extends RunWskRestCmd with BaseApi {
             var file = ""
             val fileName = swaggerFile.toString()
             try {
-              file = FileUtils.readFileToString(new File(fileName))
+              file = FileUtils.readFileToString(new File(fileName), StandardCharsets.UTF_8)
             } catch {
               case e: Throwable =>
                 return new RestResult(
@@ -1310,7 +1302,7 @@ class RunWskRestCmd() extends FlatSpec with RunWskCmd with Matchers with ScalaFu
   def convertStringIntoKeyValue(file: String,
                                 feed: Option[String] = None,
                                 web: Option[String] = None): Array[JsValue] = {
-    val input = FileUtils.readFileToString(new File(file))
+    val input = FileUtils.readFileToString(new File(file), StandardCharsets.UTF_8)
     val in = input.parseJson.convertTo[Map[String, JsValue]]
     convertMapIntoKeyValue(in, feed, web)
   }
@@ -1420,7 +1412,7 @@ class RunWskRestCmd() extends FlatSpec with RunWskCmd with Matchers with ScalaFu
       else Path(s"$basePath/namespaces/$ns/actions/$actName")
     var paramMap = Map("blocking" -> blocking.toString, "result" -> result.toString)
     val input = parameterFile map { pf =>
-      Some(FileUtils.readFileToString(new File(pf)))
+      Some(FileUtils.readFileToString(new File(pf), StandardCharsets.UTF_8))
     } getOrElse Some(parameters.toJson.toString())
     val resp = requestEntity(POST, path, paramMap, input)
     val r = new RestResult(resp.status.intValue, getRespData(resp), blocking)


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services