Skip to content

Commit

Permalink
marking authenticationcontrol.httpsession as transient to avoid probl…
Browse files Browse the repository at this point in the history
…ems when serializing. rlazoti#4
  • Loading branch information
wagnerfrancisco authored and jweyrich committed Aug 1, 2013
1 parent 5a26a2b commit dfa7c96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class AuthenticationControl implements Serializable {
private Logger logger = LoggerFactory.getLogger(AuthenticationControl.class);

private Object object;
private HttpSession httpSession;
private transient HttpSession httpSession;

public AuthenticationControl(HttpSession httpSession) {
this.httpSession = httpSession;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;

import java.io.IOException;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
import javax.servlet.http.HttpSession;

import org.junit.Before;
Expand Down Expand Up @@ -49,4 +52,14 @@ public void testDestroySession() {
assertNull(authenticationControl.getObjectInTheSession());
}

@Test
public void testSerialization() throws IOException {
authenticationControl.createSession(object);

ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);

oos.writeObject(authenticationControl);
}

}

0 comments on commit dfa7c96

Please sign in to comment.