Skip to content

Commit

Permalink
[SQL] [TEST] [MINOR] Follow-up of PR #6493, use Guava API to ensure J…
Browse files Browse the repository at this point in the history
…ava 6 friendliness

This is a follow-up of PR #6493, which has been reverted in branch-1.4 because it uses Java 7 specific APIs and breaks Java 6 build. This PR replaces those APIs with equivalent Guava ones to ensure Java 6 friendliness.

cc andrewor14 pwendell, this should also be back ported to branch-1.4.

Author: Cheng Lian <[email protected]>

Closes #6547 from liancheng/override-log4j and squashes the following commits:

c900cfd [Cheng Lian] Addresses Shixiong's comment
72da795 [Cheng Lian] Uses Guava API to ensure Java 6 friendliness

(cherry picked from commit 5cd6a63)
Signed-off-by: Andrew Or <[email protected]>
  • Loading branch information
liancheng authored and Andrew Or committed Jun 3, 2015
1 parent daeaa0c commit 0d83720
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ package org.apache.spark.sql.hive.thriftserver

import java.io.File
import java.net.URL
import java.nio.charset.StandardCharsets
import java.nio.file.{Files, Paths}
import java.sql.{Date, DriverManager, Statement}

import scala.collection.mutable.ArrayBuffer
Expand All @@ -29,6 +27,8 @@ import scala.concurrent.{Await, Promise}
import scala.sys.process.{Process, ProcessLogger}
import scala.util.{Random, Try}

import com.google.common.base.Charsets.UTF_8
import com.google.common.io.Files
import org.apache.hadoop.hive.conf.HiveConf.ConfVars
import org.apache.hive.jdbc.HiveDriver
import org.apache.hive.service.auth.PlainSaslHelper
Expand Down Expand Up @@ -441,13 +441,14 @@ abstract class HiveThriftServer2Test extends FunSuite with BeforeAndAfterAll wit
val tempLog4jConf = Utils.createTempDir().getCanonicalPath

Files.write(
Paths.get(s"$tempLog4jConf/log4j.properties"),
"""log4j.rootCategory=INFO, console
|log4j.appender.console=org.apache.log4j.ConsoleAppender
|log4j.appender.console.target=System.err
|log4j.appender.console.layout=org.apache.log4j.PatternLayout
|log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n
""".stripMargin.getBytes(StandardCharsets.UTF_8))
""".stripMargin,
new File(s"$tempLog4jConf/log4j.properties"),
UTF_8)

tempLog4jConf + File.pathSeparator + sys.props("java.class.path")
}
Expand Down

0 comments on commit 0d83720

Please sign in to comment.