HBASE-11413 [findbugs] RV: Negating the result of compareTo()/compare() (Mike Drob)

This commit is contained in:
stack 2014-07-02 10:06:15 -07:00
parent 7a2527da4b
commit 9ff90931dc
3 changed files with 5 additions and 5 deletions

View File

@ -294,10 +294,10 @@ public class CatalogJanitor extends Chore {
// Compare start keys.
result = Bytes.compareTo(left.getStartKey(), right.getStartKey());
if (result != 0) return result;
// Compare end keys.
result = rowEndKeyComparator.compare(left.getEndKey(), right.getEndKey());
// Compare end keys, but flip the operands so parent comes first
result = rowEndKeyComparator.compare(right.getEndKey(), left.getEndKey());
return -result; // Flip the result so parent comes first.
return result;
}
}

View File

@ -524,7 +524,7 @@ public class NamespaceUpgrade implements Tool {
new Comparator<FileStatus>() {
@Override
public int compare(FileStatus left, FileStatus right) {
return -left.compareTo(right);
return right.compareTo(left);
}};
// logic culled from FSTableDescriptors

View File

@ -378,7 +378,7 @@ public class FSTableDescriptors implements TableDescriptors {
new Comparator<FileStatus>() {
@Override
public int compare(FileStatus left, FileStatus right) {
return -left.compareTo(right);
return right.compareTo(left);
}};
/**