[java-identity-provider COMMIT] /trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/CounterStorageKeyCo...
noreply at shibboleth.net
noreply at shibboleth.net
Wed Feb 25 21:00:55 EST 2015
Author: tzeller
Date: Wed Feb 25 21:00:55 2015
New Revision: 7379
URL: http://svn.shibboleth.net/view/java-identity-provider?rev=7379&view=rev
Log:
Revert r7375.
Modified:
trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/CounterStorageKeyComparator.java
Modified: trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/CounterStorageKeyComparator.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/CounterStorageKeyComparator.java?rev=7379&r1=7378&r2=7379&view=diff
==============================================================================
--- trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/CounterStorageKeyComparator.java (original)
+++ trunk/idp-consent/src/main/java/net/shibboleth/idp/consent/logic/CounterStorageKeyComparator.java Wed Feb 25 21:00:55 2015
@@ -60,16 +60,24 @@
/** {@inheritDoc} */
public int compare(String o1, String o2) {
- final Long counter1 = keyToCounterMap.containsKey(o1) ? keyToCounterMap.get(o1) : 0;
- final Long counter2 = keyToCounterMap.containsKey(o2) ? keyToCounterMap.get(o2) : 0;
+ final Long counter1 = keyToCounterMap.get(o1);
+ final Long counter2 = keyToCounterMap.get(o2);
- if (counter1.equals(counter2)) {
+ if (counter1 == null && counter2 == null) {
// Compare based on storage key list ordering.
return Integer.compare(storageKeys.indexOf(o1), storageKeys.indexOf(o2));
+ } else if (counter1 == null) {
+ return -1;
+ } else if (counter2 == null) {
+ return 1;
+ } else if (counter1.equals(counter2)) {
+ // Compare based on storage key list ordering.
+ return Integer.compare(storageKeys.indexOf(o1), storageKeys.indexOf(o2));
+ } else {
+ // Compare counters.
+ return Long.compare(counter1, counter2);
}
- // Compare counters.
- return Long.compare(counter1, counter2);
}
}
More information about the commits
mailing list