diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java index d788c70..2b07bd6 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java @@ -17,6 +17,7 @@ package org.apache.hadoop.hbase.util; import java.io.ByteArrayOutputStream; +import java.io.DataInput; import java.io.DataInputStream; import java.io.IOException; import java.io.InputStream; @@ -573,6 +574,13 @@ public final class ByteBufferUtils { } public static boolean equals(ByteBuffer buf1, int o1, int l1, ByteBuffer buf2, int o2, int l2) { + if ((l1 == 0) || (l2 == 0)) { + if ((l1 == 0) && (l2 == 0)) { + return true; + } else { + return false; + } + } // Since we're often comparing adjacent sorted data, // it's usual to have equal arrays except for the very last byte // so check that first @@ -627,6 +635,13 @@ public final class ByteBufferUtils { } public static boolean equals(ByteBuffer buf1, int o1, int l1, byte[] buf2, int o2, int l2) { + if ((l1 == 0) || (l2 == 0)) { + if ((l1 == 0) && (l2 == 0)) { + return true; + } else { + return false; + } + } // Since we're often comparing adjacent sorted data, // it's usual to have equal arrays except for the very last byte // so check that first