Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package org.apache.spark.sql.hive.test
import java.io.File
import java.lang.management.ManagementFactory
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Paths}

import org.apache.spark.util.{SparkTestUtils, Utils}

Expand Down Expand Up @@ -64,6 +63,8 @@ object TestHiveUdfsJar {
private def readResource(name: String): String = {
val url = Thread.currentThread().getContextClassLoader.getResource(name)
assert(url != null, s"Resource not found: $name")
new String(Files.readAllBytes(Paths.get(url.toURI)), StandardCharsets.UTF_8)
Utils.tryWithResource(url.openStream()) { is =>
new String(is.readAllBytes(), StandardCharsets.UTF_8)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package org.apache.spark.sql.hive.test
import java.io.File
import java.lang.management.ManagementFactory
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Paths}

import org.apache.spark.util.{SparkTestUtils, Utils}

Expand Down Expand Up @@ -52,6 +51,8 @@ object TestSpark21101Jar {
private def readResource(name: String): String = {
val url = Thread.currentThread().getContextClassLoader.getResource(name)
assert(url != null, s"Resource not found: $name")
new String(Files.readAllBytes(Paths.get(url.toURI)), StandardCharsets.UTF_8)
Utils.tryWithResource(url.openStream()) { is =>
new String(is.readAllBytes(), StandardCharsets.UTF_8)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package org.apache.spark.sql.hive.test
import java.io.File
import java.lang.management.ManagementFactory
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Paths}

import org.apache.spark.TestUtils
import org.apache.spark.util.Utils
Expand All @@ -34,7 +33,9 @@ object TestUDTFJar {
private def loadResource(name: String): String = {
val url = Thread.currentThread().getContextClassLoader.getResource(name)
assert(url != null, s"Resource not found: $name")
new String(Files.readAllBytes(Paths.get(url.toURI)), StandardCharsets.UTF_8)
Utils.tryWithResource(url.openStream()) { is =>
new String(is.readAllBytes(), StandardCharsets.UTF_8)
}
}

private val source = Map(
Expand Down