diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b5fcf98..85704318 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Fixed +## [3.0.1] +### Fixed +- Urgent fix for "Comparison method violates its general contract!" on Report entries sorting + ## [3.0.0] ### Added/Changed - See all previous 3.0.0 beta versions @@ -501,7 +505,8 @@ dir but one is not present (should be green) Initial release -[Unreleased]: https://github.com/optyfr/JRomManager/compare/3.0.0...HEAD +[Unreleased]: https://github.com/optyfr/JRomManager/compare/3.0.1...HEAD +[3.0.1]: https://github.com/optyfr/JRomManager/compare/3.0.0...3.0.1 [3.0.0]: https://github.com/optyfr/JRomManager/compare/3.0.0-beta.20...3.0.0 [3.0.0-beta.20]: https://github.com/optyfr/JRomManager/compare/3.0.0-beta.19...3.0.0-beta.20 [3.0.0-beta.19]: https://github.com/optyfr/JRomManager/compare/3.0.0-beta.18...3.0.0-beta.19 diff --git a/changelogs/3.0.1.md b/changelogs/3.0.1.md new file mode 100644 index 00000000..c94ae328 --- /dev/null +++ b/changelogs/3.0.1.md @@ -0,0 +1,2 @@ +### Fixed +- Urgent fix for "Comparison method violates its general contract!" on Report entries sorting diff --git a/jrmcore/src/main/java/jrm/profile/report/Note.java b/jrmcore/src/main/java/jrm/profile/report/Note.java index 34bc435e..444ded26 100644 --- a/jrmcore/src/main/java/jrm/profile/report/Note.java +++ b/jrmcore/src/main/java/jrm/profile/report/Note.java @@ -87,12 +87,16 @@ protected String getCurrentEntry(Entry entry) public static Comparator getComparator() { - return (n1,n2) -> { + return (n1, n2) -> { final var name1 = n1.getName(); final var name2 = n2.getName(); - if(name1 == null) + if (name1 == null) + { + if (name2 == null) + return 0; return -1; - if(name2 == null) + } + if (name2 == null) return 1; return name1.compareToIgnoreCase(name2); }; diff --git a/jrmcore/src/main/java/jrm/profile/report/Subject.java b/jrmcore/src/main/java/jrm/profile/report/Subject.java index 5641ede6..ddc83259 100644 --- a/jrmcore/src/main/java/jrm/profile/report/Subject.java +++ b/jrmcore/src/main/java/jrm/profile/report/Subject.java @@ -164,10 +164,14 @@ public boolean equals(Object o) public static Comparator getComparator() { - return (s1,s2) -> { - if(s1.ware == null) + return (s1, s2) -> { + if (s1.ware == null) + { + if (s2.ware == null) + return 0; return -1; - else if(s2.ware == null) + } + if (s2.ware == null) return 1; return s1.ware.getName().compareToIgnoreCase(s2.ware.getName()); };