You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by st...@apache.org on 2018/05/29 21:02:07 UTC
svn commit: r1832484 -
/geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
Author: struberg
Date: Tue May 29 21:02:07 2018
New Revision: 1832484
URL: http://svn.apache.org/viewvc?rev=1832484&view=rev
Log:
fixing ConfigSource ordering
Modified:
geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
Modified: geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java?rev=1832484&r1=1832483&r2=1832484&view=diff
==============================================================================
--- geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java (original)
+++ geronimo/components/config/branches/ConfigJSR/impl/src/main/java/org/apache/geronimo/config/ConfigImpl.java Tue May 29 21:02:07 2018
@@ -309,11 +309,20 @@ public class ConfigImpl implements Confi
}
}
+ /**
+ * ConfigSources are sorted with descending ordinal.
+ * If 2 ConfigSources have the same ordinal, then they get sorted according to their name, alphabetically.
+ */
private List<ConfigSource> sortDescending(List<ConfigSource> configSources) {
configSources.sort(
- (configSource1, configSource2) -> (configSource1.getOrdinal() > configSource2.getOrdinal()) ? -1 : 1);
+ (configSource1, configSource2) -> {
+ int compare = Integer.compare(configSource2.getOrdinal(), configSource1.getOrdinal());
+ if (compare == 0) {
+ return configSource1.getName().compareTo(configSource2.getName());
+ }
+ return compare;
+ });
return configSources;
-
}
private Type getTypeOfConverter(Class clazz) {