You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by as...@apache.org on 2019/09/26 14:19:58 UTC

[oozie] branch master updated: OOZIE-3465 Migrate from commons-codec (matijhs via asalamon74)

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

asalamon74 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/oozie.git


The following commit(s) were added to refs/heads/master by this push:
     new d4bd338  OOZIE-3465 Migrate from commons-codec (matijhs via asalamon74)
d4bd338 is described below

commit d4bd3384aba3d1c33b0e0a067a3866e931683b71
Author: Andras Salamon <as...@apache.org>
AuthorDate: Thu Sep 26 16:18:51 2019 +0200

    OOZIE-3465 Migrate from commons-codec (matijhs via asalamon74)
---
 .../java/org/apache/oozie/client/AuthOozieClient.java    |  5 +++--
 .../oozie/workflow/lite/LiteWorkflowAppParser.java       |  8 ++++----
 .../oozie/servlet/TestAuthFilterAuthOozieClient.java     |  4 ++--
 pom.xml                                                  | 12 ++++++------
 release-log.txt                                          |  1 +
 sharelib/git/pom.xml                                     | 16 ++++++++++++++++
 sharelib/oozie/pom.xml                                   |  6 ++++++
 sharelib/sqoop/pom.xml                                   |  6 ++++++
 8 files changed, 44 insertions(+), 14 deletions(-)

diff --git a/client/src/main/java/org/apache/oozie/client/AuthOozieClient.java b/client/src/main/java/org/apache/oozie/client/AuthOozieClient.java
index 7f65854..cad9cf5 100644
--- a/client/src/main/java/org/apache/oozie/client/AuthOozieClient.java
+++ b/client/src/main/java/org/apache/oozie/client/AuthOozieClient.java
@@ -34,10 +34,11 @@ import java.nio.file.Files;
 import java.nio.file.StandardCopyOption;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Base64;
 
 import com.google.common.annotations.VisibleForTesting;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-import org.apache.commons.codec.binary.Base64;
+
 import org.apache.commons.io.FilenameUtils;
 import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
 import org.apache.hadoop.security.authentication.client.AuthenticationException;
@@ -105,7 +106,7 @@ public class AuthOozieClient extends XOozieClient {
 
     @VisibleForTesting
     public String getAuthCacheFileName(String oozieUrl) {
-        String encodeBase64OozieUrl = Base64.encodeBase64URLSafeString(oozieUrl.getBytes(StandardCharsets.UTF_8));
+        String encodeBase64OozieUrl = Base64.getEncoder().encodeToString(oozieUrl.getBytes(StandardCharsets.UTF_8));
         String filename = ".oozie-auth-token-" + encodeBase64OozieUrl;
         if (filename.length() >= AUTH_TOKEN_CACHE_FILENAME_MAXLENGTH) {
             filename = filename.substring(0, AUTH_TOKEN_CACHE_FILENAME_MAXLENGTH);
diff --git a/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowAppParser.java b/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowAppParser.java
index 1f121c5..7fe6590 100644
--- a/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowAppParser.java
+++ b/core/src/main/java/org/apache/oozie/workflow/lite/LiteWorkflowAppParser.java
@@ -18,7 +18,6 @@
 
 package org.apache.oozie.workflow.lite;
 
-import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Writable;
@@ -62,6 +61,7 @@ import java.util.zip.Deflater;
 import java.util.zip.DeflaterOutputStream;
 import java.util.zip.Inflater;
 import java.util.zip.InflaterInputStream;
+import java.util.Base64;
 
 /**
  * Class to parse and validate workflow xml
@@ -333,7 +333,7 @@ public class LiteWorkflowAppParser {
     private GlobalSectionData getGlobalFromString(String globalStr) throws WorkflowException {
         GlobalSectionData globalSectionData = new GlobalSectionData();
         try {
-            byte[] data = Base64.decodeBase64(globalStr);
+            byte[] data = Base64.getDecoder().decode(globalStr);
             Inflater inflater = new Inflater();
             DataInputStream ois = new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(data), inflater));
             globalSectionData.readFields(ois);
@@ -362,7 +362,7 @@ public class LiteWorkflowAppParser {
         } catch (IOException e) {
             throw new WorkflowException(ErrorCode.E0700, "Error while processing global section conf");
         }
-        return Base64.encodeBase64String(baos.toByteArray());
+        return Base64.getEncoder().encodeToString(baos.toByteArray());
     }
 
     private void addChildElement(Element parent, Namespace ns, String childName, String childValue) {
@@ -605,4 +605,4 @@ public class LiteWorkflowAppParser {
     private void addResourceManager(final Element actionElement, final Namespace actionNs, final String jobTracker) {
             addChildElement(actionElement, actionNs, RESOURCE_MANAGER, jobTracker);
     }
-}
\ No newline at end of file
+}
diff --git a/core/src/test/java/org/apache/oozie/servlet/TestAuthFilterAuthOozieClient.java b/core/src/test/java/org/apache/oozie/servlet/TestAuthFilterAuthOozieClient.java
index d4c1bd0..5a23329 100644
--- a/core/src/test/java/org/apache/oozie/servlet/TestAuthFilterAuthOozieClient.java
+++ b/core/src/test/java/org/apache/oozie/servlet/TestAuthFilterAuthOozieClient.java
@@ -18,7 +18,6 @@
 
 package org.apache.oozie.servlet;
 
-import org.apache.commons.codec.binary.Base64;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.authentication.client.AuthenticatedURL;
 import org.apache.hadoop.security.authentication.client.AuthenticationException;
@@ -52,6 +51,7 @@ import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Map;
 import java.util.concurrent.Callable;
+import java.util.Base64;
 
 /**
  *
@@ -374,7 +374,7 @@ public class TestAuthFilterAuthOozieClient extends XTestCase {
         md.update(str.getBytes(StandardCharsets.UTF_8));
         md.update(secret);
         byte[] digest = md.digest();
-        return new Base64(0).encodeToString(digest);
+        return Base64.getEncoder().encodeToString(digest);
     }
 
     /**
diff --git a/pom.xml b/pom.xml
index d73d578..00818a4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -326,6 +326,12 @@
             </dependency>
 
             <dependency>
+                <groupId>commons-codec</groupId>
+                <artifactId>commons-codec</artifactId>
+                <version>1.10</version>
+            </dependency>
+
+            <dependency>
                 <groupId>junit</groupId>
                 <artifactId>junit</artifactId>
                 <version>4.11</version>
@@ -849,12 +855,6 @@
             </dependency>
 
             <dependency>
-                <groupId>commons-codec</groupId>
-                <artifactId>commons-codec</artifactId>
-                <version>1.4</version>
-            </dependency>
-
-            <dependency>
                 <groupId>net.sf.ehcache</groupId>
                 <artifactId>ehcache-core</artifactId>
                 <version>2.6.3</version>
diff --git a/release-log.txt b/release-log.txt
index 85640d2..4355b04 100644
--- a/release-log.txt
+++ b/release-log.txt
@@ -1,5 +1,6 @@
 -- Oozie 5.2.0 release (trunk - unreleased)
 
+OOZIE-3465 Migrate from commons-codec (matijhs via asalamon74)
 OOZIE-3533 Flaky test TestXLogService.testLog4jReload (asalamon74 via kmarton)
 OOZIE-3544 Upgrade commons-beanutils to 1.9.4 (matijhs via asalamon74)
 OOZIE-3543 Upgrade quartz to 2.3.1 (matijhs via asalamon74)
diff --git a/sharelib/git/pom.xml b/sharelib/git/pom.xml
index 763708e..9a41a3b 100644
--- a/sharelib/git/pom.xml
+++ b/sharelib/git/pom.xml
@@ -52,6 +52,10 @@
                     <groupId>org.apache.hive</groupId>
                     <artifactId>hive-exec</artifactId>
                 </exclusion>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
             </exclusions>
             <scope>provided</scope>
         </dependency>
@@ -61,12 +65,24 @@
             <artifactId>oozie-core</artifactId>
             <classifier>tests</classifier>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
             <groupId>org.apache.oozie</groupId>
             <artifactId>oozie-client</artifactId>
             <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.hadoop</groupId>
diff --git a/sharelib/oozie/pom.xml b/sharelib/oozie/pom.xml
index b2a1b0a..65041fa 100644
--- a/sharelib/oozie/pom.xml
+++ b/sharelib/oozie/pom.xml
@@ -42,6 +42,12 @@
             <groupId>org.apache.hadoop</groupId>
             <artifactId>hadoop-client</artifactId>
             <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
 
         <dependency>
diff --git a/sharelib/sqoop/pom.xml b/sharelib/sqoop/pom.xml
index 9a21ec4..1bd50f3 100644
--- a/sharelib/sqoop/pom.xml
+++ b/sharelib/sqoop/pom.xml
@@ -180,6 +180,12 @@
             <groupId>org.apache.oozie</groupId>
             <artifactId>oozie-core</artifactId>
             <scope>provided</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>commons-codec</groupId>
+                    <artifactId>commons-codec</artifactId>
+                </exclusion>
+            </exclusions>
         </dependency>
         <dependency>
             <groupId>org.apache.oozie</groupId>