mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-22 15:10:02 +00:00
Fix: CompareTo when discriminatorString is null
- Fix for regression introduced by #2646 in version 13.3.1 - Replaces PR #2664
This commit is contained in:
1 parent
4ba23ebc22
commit
5b9ca2933f
2 files changed
+24
-7
No files matched your search
+3
-7
@@ -259,15 +259,11 @@ public final class DeployInheritInfo implements Comparable<DeployInheritInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(DeployInheritInfo o) {
|
public int compareTo(DeployInheritInfo other) {
|
||||||
if (o == this || o.discriminatorStringValue == null && discriminatorStringValue == null) {
|
if (other == this) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (o.discriminatorStringValue == null) {
|
|
||||||
return 1;
|
|
||||||
} else if (discriminatorStringValue == null) {
|
|
||||||
return -1;
|
|
||||||
} else {
|
} else {
|
||||||
return discriminatorStringValue.compareTo(o.discriminatorStringValue);
|
return type.getName().compareTo(other.type.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
package io.ebeaninternal.server.deploy.parse;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
class DeployInheritInfoTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void addChild_when_DiscriminatorValueIsNull() {
|
||||||
|
DeployInheritInfo root = new DeployInheritInfo(Object.class);
|
||||||
|
root.addChild(new DeployInheritInfo(Integer.class)); // DiscriminatorValue is null
|
||||||
|
root.addChild(new DeployInheritInfo(Short.class)); // DiscriminatorValue is null
|
||||||
|
|
||||||
|
DeployInheritInfo c2 = new DeployInheritInfo(Long.class);
|
||||||
|
c2.setDiscriminatorValue("c2");
|
||||||
|
root.addChild(c2);
|
||||||
|
|
||||||
|
assertThat(root.children()).hasSize(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user