Skip to content

Commit

Permalink
Urgent fix
Browse files Browse the repository at this point in the history
Urgent fix for "Comparison method violates its general contract!" on
Report entries sorting

Fixes #266
  • Loading branch information
optyfr committed Mar 30, 2024
1 parent eb121b2 commit 32f4c58
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions changelogs/3.0.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
### Fixed
- Urgent fix for "Comparison method violates its general contract!" on Report entries sorting
10 changes: 7 additions & 3 deletions jrmcore/src/main/java/jrm/profile/report/Note.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,16 @@ protected String getCurrentEntry(Entry entry)

public static Comparator<Note> 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);
};
Expand Down
10 changes: 7 additions & 3 deletions jrmcore/src/main/java/jrm/profile/report/Subject.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,14 @@ public boolean equals(Object o)

public static Comparator<Subject> 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());
};
Expand Down

0 comments on commit 32f4c58

Please sign in to comment.