on 12/24/2000 1:26 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> + try {
> + fStream = new FileOutputStream(f);
> + oStream = new ObjectOutputStream(fStream);
> + // Serialize to file all active session
> + Enumeration ids = sessions.keys();
> + ServerSession session = null;
> + while (ids.hasMoreElements()) {
> + session =
> findSession(ids.nextElement().toString());
> + if (!session.getTimeStamp().isValid())
> + continue;
> + oStream.writeObject(session);
> + }
> + oStream.flush();
> + fStream.close();
> + } catch (Exception e) {
> + System.out.println(e);
> + }
> + }
-1
You need to do checks in here to make sure that the object that you are
trying to serialize actually implements Serializable otherwise you are going
to be screwed because as soon as you hit the object that isn't Serializable,
then you are going to throw the exception and the rest of your sessions are
not going to be serialized.
This is yet another reason why the Servlet API spec should only allow people
to place Serializable objects into the Session.
love,
-jon
--
Honk if you love peace and quiet.