diff --git a/src/main/scala/com/snowflake/snowpark/internal/UDFClassPath.scala b/src/main/scala/com/snowflake/snowpark/internal/UDFClassPath.scala index bafe7a0e..aedbc8a6 100644 --- a/src/main/scala/com/snowflake/snowpark/internal/UDFClassPath.scala +++ b/src/main/scala/com/snowflake/snowpark/internal/UDFClassPath.scala @@ -7,7 +7,6 @@ import com.fasterxml.jackson.databind.JsonNode import java.io.File import java.net.{URI, URLClassLoader} import com.snowflake.snowpark.Session -import sun.net.www.ParseUtil object UDFClassPath extends Logging { @@ -94,13 +93,7 @@ object UDFClassPath extends Logging { if (path.contains(":")) { path = path.substring(path.indexOf(":") + 1) } - /* - * The URL in class loader is encoded, so we have to decode it to read the - * local file. - */ - path = ParseUtil.decode(path) - // Creating a File fixes the separator based on OS - new File(path).getPath + new URI(path).getPath } } @@ -111,9 +104,7 @@ object UDFClassPath extends Logging { * The URL in CodeSource location is encoded, so we have to decode it to read the * local file. */ - val parsed = ParseUtil.decode(codeSource.getLocation.getPath) - // Creating a File fixes the separator based on OS - Some(new File(parsed).getPath) + Some(new URI(codeSource.getLocation.getPath).getPath) } else { None } diff --git a/src/test/scala/com/snowflake/snowpark/UDFRegistrationSuite.scala b/src/test/scala/com/snowflake/snowpark/UDFRegistrationSuite.scala index b18207be..1c0984b6 100644 --- a/src/test/scala/com/snowflake/snowpark/UDFRegistrationSuite.scala +++ b/src/test/scala/com/snowflake/snowpark/UDFRegistrationSuite.scala @@ -5,7 +5,6 @@ import com.snowflake.snowpark.internal.Utils.clientPackageName import java.io.{BufferedOutputStream, File, FileOutputStream} import java.nio.file.{Files, NoSuchFileException} import com.snowflake.snowpark.internal.{JavaUtils, UDFClassPath} -import sun.net.www.ParseUtil import scala.reflect.internal.util.BatchSourceFile import scala.reflect.io.{AbstractFile, VirtualDirectory} @@ -23,11 +22,6 @@ class UDFRegistrationSuite extends SNTestBase with FileUtils { session.runQuery(s"create or replace temporary stage $tempStage") } - test("Test URL encoding") { - val inputs = Seq("dbiufwhronr==", "fdeswfirn--", "bsdij++", "sb#i", "bxsj%i@9h(nb)") - inputs.foreach(str => assert(ParseUtil.decode(ParseUtil.encodePath(str)) == str)) - } - test("Test that jar files are uploaded to stage correctly") { val udfRegistrar = new UDFRegistration(session) val classDirs = UDFClassPath.classDirs(session).toList