You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2021/01/18 12:39:53 UTC

[spark] branch branch-3.1 updated: [SPARK-34151][SQL] Replaces `java.io.File.toURL` with `java.io.File.toURI.toURL`

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/branch-3.1 by this push:
     new 78a4098  [SPARK-34151][SQL] Replaces `java.io.File.toURL` with `java.io.File.toURI.toURL`
78a4098 is described below

commit 78a4098a85afadd932e4338a5d844ffaae930623
Author: yangjie01 <ya...@baidu.com>
AuthorDate: Mon Jan 18 21:39:00 2021 +0900

    [SPARK-34151][SQL] Replaces `java.io.File.toURL` with `java.io.File.toURI.toURL`
    
    ### What changes were proposed in this pull request?
    `java.io.FIle.toURL` method does not automatically escape characters that are illegal in URLs.
    
    Java doc recommended that new code convert an abstract pathname into a URL by first converting it into a URI, via the `toURI` method, and then converting the URI into a URL via the `URI.toURL` method.
    
    So this pr cleaned up the relevant cases in Spark code.
    
    ### Why are the changes needed?
    Cleaning up `Deprecated` Java API usage.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    Pass the Jenkins or GitHub Action
    
    Closes #31230 from LuciferYang/SPARK-34151.
    
    Authored-by: yangjie01 <ya...@baidu.com>
    Signed-off-by: HyukjinKwon <gu...@apache.org>
    (cherry picked from commit 163afa6fcf2017a26e2ffbd7cd4208c674c2cdfb)
    Signed-off-by: HyukjinKwon <gu...@apache.org>
---
 sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala
index 46a8e96..6b337ea 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveUtils.scala
@@ -369,10 +369,10 @@ private[spark] object HiveUtils extends Logging {
           logWarning(s"Hive jar path '${file.getPath}' does not exist.")
           Nil
         } else {
-          files.filter(_.getName.toLowerCase(Locale.ROOT).endsWith(".jar")).map(_.toURL).toSeq
+          files.filter(_.getName.toLowerCase(Locale.ROOT).endsWith(".jar")).map(_.toURI.toURL).toSeq
         }
       } else {
-        file.toURL :: Nil
+        file.toURI.toURL :: Nil
       }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org