diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java index 71474b14b88..705e6493687 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java @@ -103,7 +103,7 @@ public NumberFormat initialValue() { @Override public int compareTo(ReservationId other) { if (this.getClusterTimestamp() - other.getClusterTimestamp() == 0) { - return getId() > getId() ? 1 : getId() < getId() ? -1 : 0; + return this.getId() > other.getId() ? 1 : (this.getId() < other.getId() ? -1 : 0); } else { return this.getClusterTimestamp() > other.getClusterTimestamp() ? 1 : this.getClusterTimestamp() < other.getClusterTimestamp() ? -1 : 0;