Skip to content

Commit 10a3ddc

Browse files
committed
Remove unnecessary serialization code
1 parent b3ca5e6 commit 10a3ddc

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

src/spec/java/org/springframework/mock/web/MockHttpSession.java

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.springframework.util.Assert;
2525
import org.springframework.util.StringUtils;
2626

27-
import java.io.Serializable;
2827
import java.util.*;
2928

3029
/**
@@ -42,12 +41,6 @@
4241
@SuppressWarnings("deprecation")
4342
public class MockHttpSession implements HttpSession {
4443

45-
/**
46-
* The session cookie name.
47-
*/
48-
public static final String SESSION_COOKIE_NAME = "JSESSION";
49-
50-
5144
private static int nextId = 1;
5245

5346
private String id;
@@ -258,42 +251,4 @@ public boolean isNew() {
258251
assertIsValid();
259252
return this.isNew;
260253
}
261-
262-
/**
263-
* Serialize the attributes of this session into an object that can be
264-
* turned into a byte array with standard Java serialization.
265-
* @return a representation of this session's serialized state
266-
*/
267-
public Serializable serializeState() {
268-
HashMap<String, Serializable> state = new HashMap<>();
269-
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
270-
Map.Entry<String, Object> entry = it.next();
271-
String name = entry.getKey();
272-
Object value = entry.getValue();
273-
it.remove();
274-
if (value instanceof Serializable) {
275-
state.put(name, (Serializable) value);
276-
}
277-
else {
278-
// Not serializable... Servlet containers usually automatically
279-
// unbind the attribute in this case.
280-
if (value instanceof HttpSessionBindingListener) {
281-
((HttpSessionBindingListener) value).valueUnbound(new HttpSessionBindingEvent(this, name, value));
282-
}
283-
}
284-
}
285-
return state;
286-
}
287-
288-
/**
289-
* Deserialize the attributes of this session from a state object created by
290-
* {@link #serializeState()}.
291-
* @param state a representation of this session's serialized state
292-
*/
293-
@SuppressWarnings("unchecked")
294-
public void deserializeState(Serializable state) {
295-
Assert.isTrue(state instanceof Map, "Serialized state needs to be of type [java.util.Map]");
296-
this.attributes.putAll((Map<String, Object>) state);
297-
}
298-
299254
}

0 commit comments

Comments
 (0)