From 96af492a9caf047648c17b7762d1e2fb440bf73a Mon Sep 17 00:00:00 2001 From: SirWayne Date: Wed, 18 May 2016 15:02:49 +0200 Subject: [PATCH] Fix NPE in equals Signed-off-by: SirWayne --- .../hawkbit/ui/artifacts/upload/UploadHandler.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadHandler.java b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadHandler.java index 77207bd50..d5c6759b5 100644 --- a/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadHandler.java +++ b/hawkbit-ui/src/main/java/org/eclipse/hawkbit/ui/artifacts/upload/UploadHandler.java @@ -339,7 +339,7 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene public int hashCode() { final int prime = 31; int result = 1; - result = prime * result + (fileName == null ? 0 : fileName.hashCode()); + result = prime * result + ((fileName == null) ? 0 : fileName.hashCode()); return result; } @@ -348,12 +348,17 @@ public class UploadHandler implements StreamVariable, Receiver, SucceededListene if (this == obj) { return true; } - if (!(obj instanceof UploadHandler)) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { return false; } final UploadHandler other = (UploadHandler) obj; - if (fileName == null && other.fileName != null) { - return false; + if (fileName == null) { + if (other.fileName != null) { + return false; + } } else if (!fileName.equals(other.fileName)) { return false; }