spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vanzin <...@git.apache.org>
Subject [GitHub] spark pull request: [WIP]SPARK-2098: All Spark processes should su...
Date Tue, 08 Jul 2014 17:35:10 GMT
Github user vanzin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/1256#discussion_r14667704
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -1286,4 +1286,43 @@ private[spark] object Utils extends Logging {
         }
       }
     
    +  /** Load properties present in the given file. */
    +  def getPropertiesFromFile(filename: String): Seq[(String, String)] = {
    +    val file = new File(filename)
    +    require(file.exists(), s"Properties file $file does not exist")
    +    require(file.isFile(), s"Properties file $file is not a normal file")
    +    val inputStream = new FileInputStream(file)
    +    getPropertiesFromInputStream(inputStream)
    +  }
    +
    +  /** Load properties present in the given inputStream. */
    +  private[spark] def getPropertiesFromInputStream(inputStream: InputStream):
    +    Seq[(String, String)] = {
    +    try {
    +      val properties = new Properties()
    +      properties.load(inputStream)
    --- End diff --
    
    You should use `Properties.load(Reader)` here, and require UTF-8. `Properties.load(InputStream)`
is restricted to ISO-8859-1.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message