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 > whiteListPatterns = // NOSONAR lower case static
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,12 @@ public Message(byte[] body, MessageProperties messageProperties) { //NOSONAR
79
71
}
80
72
81
73
/**
82
- * Add patterns to the white list of permissable 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
*/
93
79
public static void addWhiteListPatterns (String ... patterns ) {
94
- Assert .notNull (patterns , "'patterns' cannot be null" );
95
- whiteListPatterns .addAll (Arrays .asList (patterns ));
96
80
}
97
81
98
82
/**
@@ -132,8 +116,7 @@ private String getBodyContentAsString() {
132
116
boolean nullProps = this .messageProperties == null ;
133
117
String contentType = nullProps ? null : this .messageProperties .getContentType ();
134
118
if (MessageProperties .CONTENT_TYPE_SERIALIZED_OBJECT .equals (contentType )) {
135
- return SerializationUtils .deserialize (new ByteArrayInputStream (this .body ), whiteListPatterns ,
136
- ClassUtils .getDefaultClassLoader ()).toString ();
119
+ return "[serialized object]" ;
137
120
}
138
121
String encoding = encoding (nullProps );
139
122
if (MessageProperties .CONTENT_TYPE_TEXT_PLAIN .equals (contentType )
0 commit comments