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

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


The following commit(s) were added to refs/heads/master by this push:
     new 72a42de0d TEZ-4728: Replace deprecated use of Guava Charsets.UTF_8 
with StandardCharsets.UTF_8 (#511) (Raghav Aggarwal reviewed by Laszlo Bodor)
72a42de0d is described below

commit 72a42de0dfeeab0ecbcc15749ccde0eeb99c1721
Author: Raghav Aggarwal <[email protected]>
AuthorDate: Thu Jun 18 19:13:58 2026 +0530

    TEZ-4728: Replace deprecated use of Guava Charsets.UTF_8 with 
StandardCharsets.UTF_8 (#511) (Raghav Aggarwal reviewed by Laszlo Bodor)
---
 .../api/events/TestInputDataInformationEvent.java       |  7 ++++---
 .../org/apache/tez/shufflehandler/ShuffleHandler.java   |  6 ++----
 .../java/org/apache/tez/auxservices/ShuffleHandler.java |  5 ++---
 .../java/org/apache/tez/common/ProtoConverters.java     |  4 ++--
 .../library/common/security/SecureShuffleUtils.java     | 17 +++++++++--------
 .../tez/runtime/library/processor/SleepProcessor.java   |  5 ++---
 6 files changed, 21 insertions(+), 23 deletions(-)

diff --git 
a/tez-api/src/test/java/org/apache/tez/runtime/api/events/TestInputDataInformationEvent.java
 
b/tez-api/src/test/java/org/apache/tez/runtime/api/events/TestInputDataInformationEvent.java
index 52bf9a234..63f9e1179 100644
--- 
a/tez-api/src/test/java/org/apache/tez/runtime/api/events/TestInputDataInformationEvent.java
+++ 
b/tez-api/src/test/java/org/apache/tez/runtime/api/events/TestInputDataInformationEvent.java
@@ -19,8 +19,7 @@
 package org.apache.tez.runtime.api.events;
 
 import java.nio.ByteBuffer;
-
-import com.google.common.base.Charsets;
+import java.nio.charset.StandardCharsets;
 
 import org.junit.Assert;
 import org.junit.Test;
@@ -33,7 +32,9 @@ public class TestInputDataInformationEvent {
         InputDataInformationEvent.createWithSerializedPayload(0, 
ByteBuffer.wrap("payload1".getBytes()));
     // event created by createWithSerializedPayload should contain serialized 
payload
     // but not a path or a deserialized payload
-    Assert.assertEquals("payload1", 
Charsets.UTF_8.decode(eventWithSerializedPayload.getUserPayload()).toString());
+    Assert.assertEquals(
+        "payload1",
+        
StandardCharsets.UTF_8.decode(eventWithSerializedPayload.getUserPayload()).toString());
     Assert.assertNull(eventWithSerializedPayload.getSerializedPath());
     Assert.assertNull(eventWithSerializedPayload.getDeserializedUserPayload());
 
diff --git 
a/tez-ext-service-tests/src/test/java/org/apache/tez/shufflehandler/ShuffleHandler.java
 
b/tez-ext-service-tests/src/test/java/org/apache/tez/shufflehandler/ShuffleHandler.java
index 772e23a83..d16c50e99 100644
--- 
a/tez-ext-service-tests/src/test/java/org/apache/tez/shufflehandler/ShuffleHandler.java
+++ 
b/tez-ext-service-tests/src/test/java/org/apache/tez/shufflehandler/ShuffleHandler.java
@@ -38,6 +38,7 @@ import java.net.InetSocketAddress;
 import java.net.URI;
 import java.net.URL;
 import java.nio.channels.ClosedChannelException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -69,8 +70,6 @@ import 
org.apache.tez.runtime.library.common.security.SecureShuffleUtils;
 import 
org.apache.tez.runtime.library.common.shuffle.orderedgrouped.ShuffleHeader;
 import org.apache.tez.runtime.library.common.sort.impl.TezIndexRecord;
 
-import com.google.common.base.Charsets;
-
 import io.netty.bootstrap.ServerBootstrap;
 import io.netty.buffer.Unpooled;
 import io.netty.channel.Channel;
@@ -603,8 +602,7 @@ public class ShuffleHandler {
       SecureShuffleUtils.verifyReply(urlHashStr, enc_str, tokenSecret);
       // verification passed - encode the reply
       String reply =
-        SecureShuffleUtils.generateHash(urlHashStr.getBytes(Charsets.UTF_8),
-            tokenSecret);
+          
SecureShuffleUtils.generateHash(urlHashStr.getBytes(StandardCharsets.UTF_8), 
tokenSecret);
       response.headers().set(SecureShuffleUtils.HTTP_HEADER_REPLY_URL_HASH, 
reply);
       // Put shuffle version into http header
       response.headers().set(ShuffleHeader.HTTP_HEADER_NAME,
diff --git 
a/tez-plugins/tez-aux-services/src/main/java/org/apache/tez/auxservices/ShuffleHandler.java
 
b/tez-plugins/tez-aux-services/src/main/java/org/apache/tez/auxservices/ShuffleHandler.java
index 2353af95f..42f3c6834 100644
--- 
a/tez-plugins/tez-aux-services/src/main/java/org/apache/tez/auxservices/ShuffleHandler.java
+++ 
b/tez-plugins/tez-aux-services/src/main/java/org/apache/tez/auxservices/ShuffleHandler.java
@@ -41,6 +41,7 @@ import java.net.URI;
 import java.net.URL;
 import java.nio.ByteBuffer;
 import java.nio.channels.ClosedChannelException;
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -101,7 +102,6 @@ import 
org.apache.tez.runtime.library.common.sort.impl.TezIndexRecord;
 import org.apache.tez.runtime.library.common.sort.impl.TezSpillRecord;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Charsets;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.CacheLoader;
 import com.google.common.cache.LoadingCache;
@@ -1471,8 +1471,7 @@ public class ShuffleHandler extends AuxiliaryService {
       SecureShuffleUtils.verifyReply(urlHashStr, enc_str, tokenSecret);
       // verification passed - encode the reply
       String reply =
-        SecureShuffleUtils.generateHash(urlHashStr.getBytes(Charsets.UTF_8),
-            tokenSecret);
+          
SecureShuffleUtils.generateHash(urlHashStr.getBytes(StandardCharsets.UTF_8), 
tokenSecret);
       response.headers().set(SecureShuffleUtils.HTTP_HEADER_REPLY_URL_HASH, 
reply);
       // Put shuffle version into http header
       response.headers().set(ShuffleHeader.HTTP_HEADER_NAME,
diff --git 
a/tez-runtime-internals/src/main/java/org/apache/tez/common/ProtoConverters.java
 
b/tez-runtime-internals/src/main/java/org/apache/tez/common/ProtoConverters.java
index f4a146970..4c25a1284 100644
--- 
a/tez-runtime-internals/src/main/java/org/apache/tez/common/ProtoConverters.java
+++ 
b/tez-runtime-internals/src/main/java/org/apache/tez/common/ProtoConverters.java
@@ -19,6 +19,7 @@
 package org.apache.tez.common;
 
 import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
 
 import org.apache.tez.runtime.api.events.CompositeDataMovementEvent;
 import org.apache.tez.runtime.api.events.CompositeRoutedDataMovementEvent;
@@ -30,7 +31,6 @@ import 
org.apache.tez.runtime.api.events.InputDataInformationEvent;
 import org.apache.tez.runtime.api.events.InputInitializerEvent;
 import org.apache.tez.runtime.api.events.VertexManagerEvent;
 
-import com.google.common.base.Charsets;
 import com.google.protobuf.ByteString;
 
 public final class ProtoConverters {
@@ -139,7 +139,7 @@ public final class ProtoConverters {
       builder.setUserPayload(ByteString.copyFrom(event.getUserPayload()));
     }
     if (event.getSerializedPath() != null) {
-      
builder.setSerializedPath(ByteString.copyFrom(event.getSerializedPath().getBytes(Charsets.UTF_8)));
+      
builder.setSerializedPath(ByteString.copyFrom(event.getSerializedPath().getBytes(StandardCharsets.UTF_8)));
     }
     return builder.build();
   }
diff --git 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/security/SecureShuffleUtils.java
 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/security/SecureShuffleUtils.java
index be1df6093..151fe6b54 100644
--- 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/security/SecureShuffleUtils.java
+++ 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/common/security/SecureShuffleUtils.java
@@ -21,6 +21,7 @@ package org.apache.tez.runtime.library.common.security;
 
 import java.io.IOException;
 import java.net.URL;
+import java.nio.charset.StandardCharsets;
 
 import javax.crypto.SecretKey;
 
@@ -30,8 +31,6 @@ import org.apache.hadoop.classification.InterfaceStability;
 import org.apache.hadoop.io.WritableComparator;
 import org.apache.tez.common.security.JobTokenSecretManager;
 
-import com.google.common.base.Charsets;
-
 /**
  *
  * utilities for generating keys, hashes and verifying them for shuffle
@@ -49,7 +48,7 @@ public final class SecureShuffleUtils {
    * Base64 encoded hash of msg
    */
   public static String generateHash(byte[] msg, SecretKey key) {
-    return new String(Base64.encodeBase64(generateByteHash(msg, key)), 
Charsets.UTF_8);
+    return new String(Base64.encodeBase64(generateByteHash(msg, key)), 
StandardCharsets.UTF_8);
   }
 
   /**
@@ -88,7 +87,9 @@ public final class SecureShuffleUtils {
    *
    */
   public static String hashFromString(String encStr, JobTokenSecretManager 
mgr) {
-    return new 
String(Base64.encodeBase64(mgr.computeHash(encStr.getBytes(Charsets.UTF_8))), 
Charsets.UTF_8);
+    return new String(
+        
Base64.encodeBase64(mgr.computeHash(encStr.getBytes(StandardCharsets.UTF_8))),
+        StandardCharsets.UTF_8);
   }
 
   /**
@@ -102,8 +103,8 @@ public final class SecureShuffleUtils {
    * @param key        the key to use to generate the hash from the message
    */
   public static void verifyReply(String base64Hash, String msg, SecretKey key) 
throws IOException {
-    byte[] hash = Base64.decodeBase64(base64Hash.getBytes(Charsets.UTF_8));
-    boolean res = verifyHash(hash, msg.getBytes(Charsets.UTF_8), key);
+    byte[] hash = 
Base64.decodeBase64(base64Hash.getBytes(StandardCharsets.UTF_8));
+    boolean res = verifyHash(hash, msg.getBytes(StandardCharsets.UTF_8), key);
 
     if(!res) {
       throw new IOException("Verification of the hashReply failed");
@@ -118,9 +119,9 @@ public final class SecureShuffleUtils {
    */
   public static void verifyReply(String base64Hash, String msg, 
JobTokenSecretManager mgr)
       throws IOException {
-    byte[] hash = Base64.decodeBase64(base64Hash.getBytes(Charsets.UTF_8));
+    byte[] hash = 
Base64.decodeBase64(base64Hash.getBytes(StandardCharsets.UTF_8));
 
-    boolean res = verifyHash(hash, msg.getBytes(Charsets.UTF_8), mgr);
+    boolean res = verifyHash(hash, msg.getBytes(StandardCharsets.UTF_8), mgr);
 
     if(!res) {
       throw new IOException("Verification of the hashReply failed");
diff --git 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/processor/SleepProcessor.java
 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/processor/SleepProcessor.java
index 2fd541ce2..bff6c2b86 100644
--- 
a/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/processor/SleepProcessor.java
+++ 
b/tez-runtime-library/src/main/java/org/apache/tez/runtime/library/processor/SleepProcessor.java
@@ -21,6 +21,7 @@ package org.apache.tez.runtime.library.processor;
 import java.nio.ByteBuffer;
 import java.nio.charset.CharacterCodingException;
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.List;
 import java.util.Map;
 
@@ -33,8 +34,6 @@ import org.apache.tez.runtime.api.LogicalInput;
 import org.apache.tez.runtime.api.LogicalOutput;
 import org.apache.tez.runtime.api.ProcessorContext;
 
-import com.google.common.base.Charsets;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -115,7 +114,7 @@ public class SleepProcessor extends 
AbstractLogicalIOProcessor {
    */
   public static class SleepProcessorConfig {
     private int timeToSleepMS;
-    private final Charset charSet = Charsets.UTF_8;
+    private final Charset charSet = StandardCharsets.UTF_8;
 
     public SleepProcessorConfig() {
     }

Reply via email to