MAPREDUCE-5274. Bring back SecureShuffleUtils.toHex in mapreduce for binary compatibility with 1.x APIs. Contributed by Mayank Bansal.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1488625 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Vinod Kumar Vavilapalli 2013-06-01 22:21:43 +00:00
parent 8267117e10
commit 05cdca070e
2 changed files with 20 additions and 0 deletions

View File

@ -273,6 +273,9 @@ Release 2.1.0-beta - UNRELEASED
MAPREDUCE-5229. Put back FileOutputCommitter.TEMP_DIR_NAME in mapreduce for MAPREDUCE-5229. Put back FileOutputCommitter.TEMP_DIR_NAME in mapreduce for
binary compatibility with 1.x APIs. (Zhijie Shen via vinodkv) binary compatibility with 1.x APIs. (Zhijie Shen via vinodkv)
MAPREDUCE-5274. Bring back SecureShuffleUtils.toHex in mapreduce for binary
compatibility with 1.x APIs. (Mayank Bansal via vinodkv)
OPTIMIZATIONS OPTIMIZATIONS
MAPREDUCE-4974. Optimising the LineRecordReader initialize() method MAPREDUCE-4974. Optimising the LineRecordReader initialize() method

View File

@ -18,7 +18,9 @@
package org.apache.hadoop.mapreduce.security; package org.apache.hadoop.mapreduce.security;
import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream;
import java.net.URL; import java.net.URL;
import javax.crypto.SecretKey; import javax.crypto.SecretKey;
@ -131,4 +133,19 @@ public class SecureShuffleUtils {
private static String buildMsgFrom(String uri_path, String uri_query, int port) { private static String buildMsgFrom(String uri_path, String uri_query, int port) {
return String.valueOf(port) + uri_path + "?" + uri_query; return String.valueOf(port) + uri_path + "?" + uri_query;
} }
/**
* byte array to Hex String
*
* @param ba
* @return string with HEX value of the key
*/
public static String toHex(byte[] ba) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
PrintStream ps = new PrintStream(baos);
for (byte b : ba) {
ps.printf("%x", b);
}
return baos.toString();
}
} }