HADOOP-9114. After defined the dfs.checksum.type as the NULL, write file and hflush will through java.lang.ArrayIndexOutOfBoundsException. Contributed by Sathish.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1544189 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uma Maheswara Rao G 2013-11-21 14:05:28 +00:00
parent 0aa088e336
commit 709b74e515
2 changed files with 10 additions and 4 deletions

View File

@ -502,6 +502,9 @@ Release 2.2.1 - UNRELEASED
HADOOP-10110. hadoop-auth has a build break due to missing dependency. HADOOP-10110. hadoop-auth has a build break due to missing dependency.
(Chuan Liu via arp) (Chuan Liu via arp)
HADOOP-9114. After defined the dfs.checksum.type as the NULL, write file and hflush will
through java.lang.ArrayIndexOutOfBoundsException (Sathish via umamahesh)
Release 2.2.0 - 2013-10-13 Release 2.2.0 - 2013-10-13
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -183,10 +183,13 @@ static public byte[] convertToByteStream(Checksum sum, int checksumSize) {
} }
static byte[] int2byte(int integer, byte[] bytes) { static byte[] int2byte(int integer, byte[] bytes) {
bytes[0] = (byte)((integer >>> 24) & 0xFF); if (bytes.length != 0) {
bytes[1] = (byte)((integer >>> 16) & 0xFF); bytes[0] = (byte) ((integer >>> 24) & 0xFF);
bytes[2] = (byte)((integer >>> 8) & 0xFF); bytes[1] = (byte) ((integer >>> 16) & 0xFF);
bytes[3] = (byte)((integer >>> 0) & 0xFF); bytes[2] = (byte) ((integer >>> 8) & 0xFF);
bytes[3] = (byte) ((integer >>> 0) & 0xFF);
return bytes;
}
return bytes; return bytes;
} }