HDDS-126. Fix findbugs warning in MetadataKeyFilters.java. Contributed by Akira Ajisaka.

This commit is contained in:
Xiaoyu Yao 2018-06-04 08:55:01 -07:00
parent e2289c8d14
commit ab3885f2c8
1 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import org.apache.hadoop.hdfs.DFSUtil;
import org.apache.hadoop.ozone.OzoneConsts; import org.apache.hadoop.ozone.OzoneConsts;
/** /**
@ -94,7 +95,7 @@ public boolean filterKey(byte[] preKey, byte[] currentKey,
if (Strings.isNullOrEmpty(keyPrefix)) { if (Strings.isNullOrEmpty(keyPrefix)) {
accept = true; accept = true;
} else { } else {
byte [] prefixBytes = keyPrefix.getBytes(); byte [] prefixBytes = DFSUtil.string2Bytes(keyPrefix);
if (currentKey != null && prefixMatch(prefixBytes, currentKey)) { if (currentKey != null && prefixMatch(prefixBytes, currentKey)) {
keysHinted++; keysHinted++;
accept = true; accept = true;