From 84c042b118585217a4cbf66e7429cb69c60efeff Mon Sep 17 00:00:00 2001 From: anhefti Date: Tue, 7 Jan 2025 16:29:35 +0100 Subject: [PATCH] code cleanup --- .../ethz/seb/sebserver/gbl/util/Result.java | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java index a6eb39601..aeaae7964 100644 --- a/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java +++ b/src/main/java/ch/ethz/seb/sebserver/gbl/util/Result.java @@ -8,6 +8,7 @@ package ch.ethz.seb.sebserver.gbl.util; +import java.util.Objects; import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Predicate; @@ -142,7 +143,7 @@ public T getOrThrow() { if (this.error instanceof RuntimeException) { throw (RuntimeException) this.error; } else { - String cause = this.error.getMessage() != null ? this.error.getMessage() : this.error.toString(); + final String cause = this.error.getMessage() != null ? this.error.getMessage() : this.error.toString(); throw new RuntimeException("RuntimeExceptionWrapper cause: " + cause, this.error); } } @@ -381,20 +382,11 @@ public int hashCode() { } @Override - public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final Result other = (Result) obj; - if (this.value == null) { - if (other.value != null) - return false; - } else if (!this.value.equals(other.value)) - return false; - return true; + public boolean equals(final Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + final Result result = (Result) o; + return Objects.equals(value, result.value) && Objects.equals(error, result.error); } @Override