16
16
17
17
package org .springframework .amqp .core ;
18
18
19
- import java .io .ByteArrayInputStream ;
20
19
import java .io .Serializable ;
21
20
import java .nio .charset .Charset ;
22
21
import java .util .Arrays ;
23
- import java .util .LinkedHashSet ;
24
- import java .util .Set ;
25
22
26
- import org .springframework .amqp .utils .SerializationUtils ;
27
23
import org .springframework .util .Assert ;
28
- import org .springframework .util .ClassUtils ;
29
24
30
25
/**
31
26
* 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 {
48
43
49
44
private static final String DEFAULT_ENCODING = Charset .defaultCharset ().name ();
50
45
51
- private static final Set <String > ALLOWED_LIST_PATTERNS =
52
- new LinkedHashSet <>(Arrays .asList ("java.util.*" , "java.lang.*" ));
53
-
54
46
private static String bodyEncoding = DEFAULT_ENCODING ;
55
47
56
48
private final MessageProperties messageProperties ;
@@ -79,20 +71,13 @@ public Message(byte[] body, MessageProperties messageProperties) { //NOSONAR
79
71
}
80
72
81
73
/**
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.
90
76
* @param patterns the patterns.
91
77
* @since 1.5.7
92
78
*/
79
+ @ Deprecated
93
80
public static void addAllowedListPatterns (String ... patterns ) {
94
- Assert .notNull (patterns , "'patterns' cannot be null" );
95
- ALLOWED_LIST_PATTERNS .addAll (Arrays .asList (patterns ));
96
81
}
97
82
98
83
/**
@@ -128,8 +113,7 @@ private String getBodyContentAsString() {
128
113
try {
129
114
String contentType = this .messageProperties .getContentType ();
130
115
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]" ;
133
117
}
134
118
String encoding = encoding ();
135
119
if (MessageProperties .CONTENT_TYPE_TEXT_PLAIN .equals (contentType )
0 commit comments