diff options
Diffstat (limited to 'mcs/class/System.Web/System.Web.SessionState/HttpSessionState.jvm.cs')
-rw-r--r-- | mcs/class/System.Web/System.Web.SessionState/HttpSessionState.jvm.cs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.jvm.cs b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.jvm.cs index 42239d7a5d2..0524e74bc8c 100644 --- a/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.jvm.cs +++ b/mcs/class/System.Web/System.Web.SessionState/HttpSessionState.jvm.cs @@ -55,6 +55,7 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa internal bool _abandoned; private object _app; + private bool _readFirstTime = true; private bool _needSessionPersistence = false; internal HttpSessionState (string id, @@ -110,10 +111,10 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa { output.writeBoolean(_needSessionPersistence); if (!_needSessionPersistence) - //indicates that there is nothing to serialize for this object + { return; - - System.Web.J2EE.ObjectOutputStream ms = new System.Web.J2EE.ObjectOutputStream(output); + } + System.IO.MemoryStream ms = new System.IO.MemoryStream(); System.IO.BinaryWriter bw = new System.IO.BinaryWriter(ms); bw.Write(_id); _dict.Serialize(bw); @@ -130,6 +131,7 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa else bw.Write(3); bw.Write(_isReadonly); + output.writeObject(vmw.common.TypeUtils.ToSByteArray(ms.GetBuffer())); } } @@ -138,10 +140,17 @@ public sealed class HttpSessionState : ICollection, IEnumerable, java.io.Externa lock(this) { _needSessionPersistence = input.readBoolean(); - if(!_needSessionPersistence) //noting has been written + if (!_needSessionPersistence) + { return; - - System.Web.J2EE.ObjectInputStream ms = new System.Web.J2EE.ObjectInputStream( input ); + } + sbyte[] array = (sbyte[])input.readObject(); + if (!_readFirstTime || array == null || array.Length == 0) + { + return; + } + _readFirstTime = false; + System.IO.MemoryStream ms = new System.IO.MemoryStream((byte[])vmw.common.TypeUtils.ToByteArray(array)); System.IO.BinaryReader br = new System.IO.BinaryReader(ms); _id = br.ReadString(); _dict = SessionDictionary.Deserialize(br); |