Add validation.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Apr 2011 10:34:37 +0000 (12:34 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 1 Apr 2011 10:34:37 +0000 (12:34 +0200)
src/main/java/net/pterodactylus/sone/core/Core.java

index 7545d98..5a91f79 100644 (file)
@@ -525,6 +525,7 @@ public class Core implements IdentityListener, UpdateListener {
         * @return {@code true} if the target Sone is trusted by the origin Sone
         */
        public boolean isSoneTrusted(Sone origin, Sone target) {
+               Validation.begin().isNotNull("Origin", origin).isNotNull("Target", target).check().isInstanceOf("Origin’s OwnIdentity", origin.getIdentity(), OwnIdentity.class).check();
                return trustedIdentities.containsKey(origin.getIdentity()) && trustedIdentities.get(origin.getIdentity()).contains(target.getIdentity());
        }