Bladeren bron

SEC-2828: SimDestinationMessageMatcher#toString()

Rob Winch 10 jaren geleden
bovenliggende
commit
9149451b9d

+ 7 - 0
messaging/src/main/java/org/springframework/security/messaging/util/matcher/SimpDestinationMessageMatcher.java

@@ -122,4 +122,11 @@ public final class SimpDestinationMessageMatcher implements MessageMatcher<Objec
         return messageTypeMatcher;
     }
 
+
+    @Override
+    public String toString() {
+        return "SimpDestinationMessageMatcher [matcher=" + matcher
+                + ", messageTypeMatcher=" + messageTypeMatcher + ", pattern="
+                + pattern + "]";
+    }
 }

+ 21 - 16
messaging/src/main/java/org/springframework/security/messaging/util/matcher/SimpMessageTypeMatcher.java

@@ -19,7 +19,6 @@ import org.springframework.messaging.Message;
 import org.springframework.messaging.MessageHeaders;
 import org.springframework.messaging.simp.SimpMessageHeaderAccessor;
 import org.springframework.messaging.simp.SimpMessageType;
-import org.springframework.messaging.support.GenericMessage;
 import org.springframework.util.Assert;
 import org.springframework.util.ObjectUtils;
 
@@ -38,7 +37,9 @@ public class SimpMessageTypeMatcher implements MessageMatcher<Object> {
     /**
      * Creates a new instance
      *
-     * @param typeToMatch the {@link SimpMessageType} that will result in a match. Cannot be null.
+     * @param typeToMatch
+     *            the {@link SimpMessageType} that will result in a match.
+     *            Cannot be null.
      */
     public SimpMessageTypeMatcher(SimpMessageType typeToMatch) {
         Assert.notNull(typeToMatch, "typeToMatch cannot be null");
@@ -53,23 +54,27 @@ public class SimpMessageTypeMatcher implements MessageMatcher<Object> {
         return typeToMatch == messageType;
     }
 
-
-
     @Override
     public boolean equals(Object other) {
-	if (this == other) {
-		return true;
-	}
-	if (!(other instanceof SimpMessageTypeMatcher)) {
-		return false;
-	}
-	SimpMessageTypeMatcher otherMatcher = (SimpMessageTypeMatcher) other;
-	return ObjectUtils.nullSafeEquals(this.typeToMatch, otherMatcher.typeToMatch);
+        if (this == other) {
+            return true;
+        }
+        if (!(other instanceof SimpMessageTypeMatcher)) {
+            return false;
+        }
+        SimpMessageTypeMatcher otherMatcher = (SimpMessageTypeMatcher) other;
+        return ObjectUtils.nullSafeEquals(this.typeToMatch,
+                otherMatcher.typeToMatch);
+
+    }
 
+    public int hashCode() {
+        // Using nullSafeHashCode for proper array hashCode handling
+        return ObjectUtils.nullSafeHashCode(this.typeToMatch);
     }
 
-	public int hashCode() {
-		// Using nullSafeHashCode for proper array hashCode handling
-		return ObjectUtils.nullSafeHashCode(this.typeToMatch);
-	}
+    @Override
+    public String toString() {
+        return "SimpMessageTypeMatcher [typeToMatch=" + typeToMatch + "]";
+    }
 }