From 3a725e4a16c197eb3d19d795b012c933a77e4ddd Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Fri, 4 Mar 2016 01:34:38 +0100 Subject: [PATCH] fixed equals methods, Coverity issues 72280, 72281, 72283, 72284 --- .../java/org/cryptomator/filesystem/crypto/CryptoNode.java | 4 ++-- .../java/org/cryptomator/filesystem/inmem/InMemoryNode.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main/filesystem-crypto/src/main/java/org/cryptomator/filesystem/crypto/CryptoNode.java b/main/filesystem-crypto/src/main/java/org/cryptomator/filesystem/crypto/CryptoNode.java index 47993924a..3ddb9ea42 100644 --- a/main/filesystem-crypto/src/main/java/org/cryptomator/filesystem/crypto/CryptoNode.java +++ b/main/filesystem-crypto/src/main/java/org/cryptomator/filesystem/crypto/CryptoNode.java @@ -104,8 +104,8 @@ abstract class CryptoNode implements Node { if (obj instanceof CryptoNode) { CryptoNode other = (CryptoNode) obj; return this.getClass() == other.getClass() // - && (this.parent == null && other.parent == null || this.parent.equals(other.parent)) // - && (this.name == null && other.name == null || this.name.equals(other.name)); + && (this.parent == null && other.parent == null || this.parent != null && this.parent.equals(other.parent)) // + && (this.name == null && other.name == null || this.name != null && this.name.equals(other.name)); } else { return false; } diff --git a/main/filesystem-inmemory/src/main/java/org/cryptomator/filesystem/inmem/InMemoryNode.java b/main/filesystem-inmemory/src/main/java/org/cryptomator/filesystem/inmem/InMemoryNode.java index 3aa40cc82..032fb1ac0 100644 --- a/main/filesystem-inmemory/src/main/java/org/cryptomator/filesystem/inmem/InMemoryNode.java +++ b/main/filesystem-inmemory/src/main/java/org/cryptomator/filesystem/inmem/InMemoryNode.java @@ -86,8 +86,8 @@ abstract class InMemoryNode implements Node { if (obj instanceof InMemoryNode) { InMemoryNode other = (InMemoryNode) obj; return this.getClass() == other.getClass() // - && (this.parent == null && other.parent == null || this.parent.equals(other.parent)) // - && (this.name == null && other.name == null || this.name.equals(other.name)); + && (this.parent == null && other.parent == null || this.parent != null && this.parent.equals(other.parent)) // + && (this.name == null && other.name == null || this.name != null && this.name.equals(other.name)); } else { return false; }