Skip to content

Commit ac31d6a

Browse files
committed
HADOOP-8151. Error handling in snappy decompressor throws invalid exceptions. Contributed by Matt Foley. (harsh)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1389006 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2837907 commit ac31d6a

File tree

5 files changed

+10
-7
lines changed

5 files changed

+10
-7
lines changed

hadoop-common-project/hadoop-common/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,9 @@ Trunk (Unreleased)
222222
HADOOP-7256. Resource leak during failure scenario of closing
223223
of resources. (Ramkrishna S. Vasudevan via harsh)
224224

225+
HADOOP-8151. Error handling in snappy decompressor throws invalid
226+
exceptions. (Matt Foley via harsh)
227+
225228
OPTIMIZATIONS
226229

227230
HADOOP-7761. Improve the performance of raw comparisons. (todd)

hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Compressor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_comp
8888

8989
compressed_direct_buf_len = LZ4_compress(uncompressed_bytes, compressed_bytes, uncompressed_direct_buf_len);
9090
if (compressed_direct_buf_len < 0){
91-
THROW(env, "Ljava/lang/InternalError", "LZ4_compress failed");
91+
THROW(env, "java/lang/InternalError", "LZ4_compress failed");
9292
}
9393

9494
(*env)->SetIntField(env, thisj, Lz4Compressor_uncompressedDirectBufLen, 0);

hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Decompressor_de
8585

8686
uncompressed_direct_buf_len = LZ4_uncompress_unknownOutputSize(compressed_bytes, uncompressed_bytes, compressed_direct_buf_len, uncompressed_direct_buf_len);
8787
if (uncompressed_direct_buf_len < 0) {
88-
THROW(env, "Ljava/lang/InternalError", "LZ4_uncompress_unknownOutputSize failed.");
88+
THROW(env, "java/lang/InternalError", "LZ4_uncompress_unknownOutputSize failed.");
8989
}
9090

9191
(*env)->SetIntField(env, thisj, Lz4Decompressor_compressedDirectBufLen, 0);

hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/snappy/SnappyCompressor.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_snappy_SnappyCompresso
9898
snappy_status ret = dlsym_snappy_compress(uncompressed_bytes,
9999
uncompressed_direct_buf_len, compressed_bytes, &buf_len);
100100
if (ret != SNAPPY_OK){
101-
THROW(env, "Ljava/lang/InternalError", "Could not compress data. Buffer length is too small.");
101+
THROW(env, "java/lang/InternalError", "Could not compress data. Buffer length is too small.");
102102
return 0;
103103
}
104104
if (buf_len > JINT_MAX) {
105-
THROW(env, "Ljava/lang/InternalError", "Invalid return buffer length.");
105+
THROW(env, "java/lang/InternalError", "Invalid return buffer length.");
106106
return 0;
107107
}
108108

hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/snappy/SnappyDecompressor.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_snappy_SnappyDecompres
9292

9393
snappy_status ret = dlsym_snappy_uncompress(compressed_bytes, compressed_direct_buf_len, uncompressed_bytes, &uncompressed_direct_buf_len);
9494
if (ret == SNAPPY_BUFFER_TOO_SMALL){
95-
THROW(env, "Ljava/lang/InternalError", "Could not decompress data. Buffer length is too small.");
95+
THROW(env, "java/lang/InternalError", "Could not decompress data. Buffer length is too small.");
9696
} else if (ret == SNAPPY_INVALID_INPUT){
97-
THROW(env, "Ljava/lang/InternalError", "Could not decompress data. Input is invalid.");
97+
THROW(env, "java/lang/InternalError", "Could not decompress data. Input is invalid.");
9898
} else if (ret != SNAPPY_OK){
99-
THROW(env, "Ljava/lang/InternalError", "Could not decompress data.");
99+
THROW(env, "java/lang/InternalError", "Could not decompress data.");
100100
}
101101

102102
(*env)->SetIntField(env, thisj, SnappyDecompressor_compressedDirectBufLen, 0);

0 commit comments

Comments
 (0)