1616
1717package org .springframework .amqp .core ;
1818
19- import java .io .ByteArrayInputStream ;
2019import java .io .Serializable ;
2120import java .nio .charset .Charset ;
2221import java .util .Arrays ;
23- import java .util .LinkedHashSet ;
24- import java .util .Set ;
2522
26- import org .springframework .amqp .utils .SerializationUtils ;
2723import org .springframework .util .Assert ;
28- import org .springframework .util .ClassUtils ;
2924
3025/**
3126 * The 0-8 and 0-9-1 AMQP specifications do not define an Message class or interface. Instead, when performing an
@@ -48,9 +43,6 @@ public class Message implements Serializable {
4843
4944 private static final String DEFAULT_ENCODING = Charset .defaultCharset ().name ();
5045
51- private static final Set <String > ALLOWED_LIST_PATTERNS =
52- new LinkedHashSet <>(Arrays .asList ("java.util.*" , "java.lang.*" ));
53-
5446 private static String bodyEncoding = DEFAULT_ENCODING ;
5547
5648 private final MessageProperties messageProperties ;
@@ -79,20 +71,13 @@ public Message(byte[] body, MessageProperties messageProperties) { //NOSONAR
7971 }
8072
8173 /**
82- * Add patterns to the allowed list of permissible package/class name patterns for
83- * deserialization in {@link #toString()}.
84- * The patterns will be applied in order until a match is found.
85- * A class can be fully qualified or a wildcard '*' is allowed at the
86- * beginning or end of the class name.
87- * Examples: {@code com.foo.*}, {@code *.MyClass}.
88- * By default, only {@code java.util} and {@code java.lang} classes will be
89- * deserialized.
74+ * No longer used.
75+ * @deprecated toString() no longer deserializes the body.
9076 * @param patterns the patterns.
9177 * @since 1.5.7
9278 */
79+ @ Deprecated
9380 public static void addAllowedListPatterns (String ... patterns ) {
94- Assert .notNull (patterns , "'patterns' cannot be null" );
95- ALLOWED_LIST_PATTERNS .addAll (Arrays .asList (patterns ));
9681 }
9782
9883 /**
@@ -128,8 +113,7 @@ private String getBodyContentAsString() {
128113 try {
129114 String contentType = this .messageProperties .getContentType ();
130115 if (MessageProperties .CONTENT_TYPE_SERIALIZED_OBJECT .equals (contentType )) {
131- return SerializationUtils .deserialize (new ByteArrayInputStream (this .body ), ALLOWED_LIST_PATTERNS ,
132- ClassUtils .getDefaultClassLoader ()).toString ();
116+ return "[serialized object]" ;
133117 }
134118 String encoding = encoding ();
135119 if (MessageProperties .CONTENT_TYPE_TEXT_PLAIN .equals (contentType )
0 commit comments