Skip to content

Commit 1f82819

Browse files
committed
Merge pull request #7462 from kuhnroyal:gh-7460
* pr/7462: Polish contribution Fix undertow session persistence with spring-boot-devtools
2 parents 65b6d8f + 4c61c9f commit 1f82819

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/FileSessionPersistence.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2015 the original author or authors.
2+
* Copyright 2012-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -30,10 +30,13 @@
3030
import io.undertow.servlet.UndertowServletLogger;
3131
import io.undertow.servlet.api.SessionPersistenceManager;
3232

33+
import org.springframework.core.ConfigurableObjectInputStream;
34+
3335
/**
3436
* {@link SessionPersistenceManager} that stores session information in a file.
3537
*
3638
* @author Phillip Webb
39+
* @author Peter Leibiger
3740
* @since 1.3.0
3841
*/
3942
public class FileSessionPersistence implements SessionPersistenceManager {
@@ -82,7 +85,7 @@ public Map<String, PersistentSession> loadSessionAttributes(String deploymentNam
8285
try {
8386
File file = getSessionFile(deploymentName);
8487
if (file.exists()) {
85-
return load(file);
88+
return load(file, classLoader);
8689
}
8790
}
8891
catch (Exception ex) {
@@ -91,9 +94,10 @@ public Map<String, PersistentSession> loadSessionAttributes(String deploymentNam
9194
return null;
9295
}
9396

94-
private Map<String, PersistentSession> load(File file)
97+
private Map<String, PersistentSession> load(File file, ClassLoader classLoader)
9598
throws IOException, ClassNotFoundException {
96-
ObjectInputStream stream = new ObjectInputStream(new FileInputStream(file));
99+
ObjectInputStream stream = new ConfigurableObjectInputStream(
100+
new FileInputStream(file), classLoader);
97101
try {
98102
return load(stream);
99103
}

0 commit comments

Comments
 (0)