You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ge...@apache.org on 2017/06/14 09:15:12 UTC

oozie git commit: OOZIE-2939 Fix Findbugs warnings related to reliance on default encoding in oozie-sharelib-hive2 module (Jan Hentschel via gezapeti)

Repository: oozie
Updated Branches:
  refs/heads/master 061195621 -> 8d710142a


OOZIE-2939 Fix Findbugs warnings related to reliance on default encoding in oozie-sharelib-hive2 module (Jan Hentschel via gezapeti)


Project: http://git-wip-us.apache.org/repos/asf/oozie/repo
Commit: http://git-wip-us.apache.org/repos/asf/oozie/commit/8d710142
Tree: http://git-wip-us.apache.org/repos/asf/oozie/tree/8d710142
Diff: http://git-wip-us.apache.org/repos/asf/oozie/diff/8d710142

Branch: refs/heads/master
Commit: 8d710142ab6fb046caea08d904d0ca374625ed96
Parents: 0611956
Author: Gezapeti Cseh <ge...@gmail.com>
Authored: Wed Jun 14 11:14:59 2017 +0200
Committer: Gezapeti Cseh <ge...@gmail.com>
Committed: Wed Jun 14 11:14:59 2017 +0200

----------------------------------------------------------------------
 release-log.txt                                          |  1 +
 .../java/org/apache/oozie/action/hadoop/Hive2Main.java   | 11 ++++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/oozie/blob/8d710142/release-log.txt
----------------------------------------------------------------------
diff --git a/release-log.txt b/release-log.txt
index ab40faa..bc4c82c 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.0.0 release (trunk - unreleased)
 
+OOZIE-2939 Fix Findbugs warnings related to reliance on default encoding in oozie-sharelib-hive2 module (Jan Hentschel via gezapeti)
 OOZIE-2935 Fix "concatenates strings using + in a loop" Findbugs error in oozie-sharelib-streaming (Jan Hentschel via rkanter)
 OOZIE-2825 Custom Authentication doc page is not well formatted (Jan Hentschel via rkanter)
 OOZIE-2747 README.txt is out of date (Jan Hentschel via rkanter)

http://git-wip-us.apache.org/repos/asf/oozie/blob/8d710142/sharelib/hive2/src/main/java/org/apache/oozie/action/hadoop/Hive2Main.java
----------------------------------------------------------------------
diff --git a/sharelib/hive2/src/main/java/org/apache/oozie/action/hadoop/Hive2Main.java b/sharelib/hive2/src/main/java/org/apache/oozie/action/hadoop/Hive2Main.java
index e626dbb..4da9326 100644
--- a/sharelib/hive2/src/main/java/org/apache/oozie/action/hadoop/Hive2Main.java
+++ b/sharelib/hive2/src/main/java/org/apache/oozie/action/hadoop/Hive2Main.java
@@ -20,9 +20,10 @@ package org.apache.oozie.action.hadoop;
 
 import java.io.BufferedReader;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.FileReader;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.PrintStream;
 import java.util.ArrayList;
 import java.util.HashSet;
@@ -46,7 +47,7 @@ public class Hive2Main extends LauncherMain {
             Pattern.compile("Submitted application (application[0-9_]*)"),
             Pattern.compile("Running with YARN Application = (application[0-9_]*)")
     };
-    private static final Set<String> DISALLOWED_BEELINE_OPTIONS = new HashSet<String>();
+    private static final Set<String> DISALLOWED_BEELINE_OPTIONS = new HashSet<>();
 
     static {
         DISALLOWED_BEELINE_OPTIONS.add("-u");
@@ -116,7 +117,7 @@ public class Hive2Main extends LauncherMain {
         }
         String logFile = new File("hive2-oozie-" + hadoopJobId + ".log").getAbsolutePath();
 
-        List<String> arguments = new ArrayList<String>();
+        List<String> arguments = new ArrayList<>();
         String jdbcUrl = actionConf.get(Hive2ActionExecutor.HIVE2_JDBC_URL);
         if (jdbcUrl == null) {
             throw new RuntimeException("Action Configuration does not have [" +  Hive2ActionExecutor.HIVE2_JDBC_URL
@@ -263,7 +264,7 @@ public class Hive2Main extends LauncherMain {
     private void runBeeline(String[] args, String logFile) throws Exception {
         // We do this instead of calling BeeLine.main so we can duplicate the error stream for harvesting Hadoop child job IDs
         BeeLine beeLine = new BeeLine();
-        beeLine.setErrorStream(new PrintStream(new TeeOutputStream(System.err, new FileOutputStream(logFile))));
+        beeLine.setErrorStream(new PrintStream(new TeeOutputStream(System.err, new FileOutputStream(logFile)), false, "UTF-8"));
         int status = beeLine.begin(args, null);
         beeLine.close();
         if (status != 0) {
@@ -275,7 +276,7 @@ public class Hive2Main extends LauncherMain {
         String line;
         BufferedReader br = null;
         try {
-            br = new BufferedReader(new FileReader(filePath));
+            br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath), "UTF-8"));
             StringBuilder sb = new StringBuilder();
             String sep = System.getProperty("line.separator");
             while ((line = br.readLine()) != null) {