Improved: Fixing defects reported by FindBugs, package

org.apache.ofbiz.common.authentication.
(OFBIZ-9627)

Thanks Dennis Balkir for reporting and providing the patch.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1811421 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Brohl
2017-10-07 13:49:20 +00:00
parent 61d6a6ede0
commit 2921eff056
@@ -65,14 +65,13 @@ public class AuthenticationComparator implements Comparator<Authenticator> {
* being compared by this Comparator.
*/
public int compare(Authenticator a1, Authenticator a2) {
if (a1.getWeight() < a2.getWeight()) {
return -1;
} else if (a1.getWeight() > a2.getWeight()) {
return 1;
} else if (!a1.getClass().equals(a2.getClass())) {
return -1;
} else {
return a1.getClass().getName().compareTo(a2.getClass().getName());
int comp = Float.compare(a1.getWeight(), a2.getWeight());
if (comp != 0) {
return (int) Math.signum(comp);
}
if (!a1.getClass().equals(a2.getClass())) {
return -1;
}
return a1.getClass().getName().compareTo(a2.getClass().getName());
}
}