Author: jgomes
Date: Tue Nov 11 17:41:02 2008
New Revision: 713243

URL: http://svn.apache.org/viewvc?rev=713243&view=rev
Log:
Fixed deadlock issue with OpenWireFormat marshalling and unmarshalling.
Fixed TestBooleanMarshalling exception handling test.
Fixes [AMQNET-122]. (See https://issues.apache.org/activemq/browse/AMQNET-122)

Modified:
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
    
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/BooleanStreamTest.cs

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs?rev=713243&r1=713242&r2=713243&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/main/csharp/OpenWire/OpenWireFormat.cs
 Tue Nov 11 17:41:02 2008
@@ -224,17 +224,18 @@
 
                public Object Unmarshal(BinaryReader dis)
                {
-                       lock(this.marshalLock)
+                       // lets ignore the size of the packet
+                       if(!sizePrefixDisabled)
                        {
-                               // lets ignore the size of the packet
-                               if(!sizePrefixDisabled)
-                               {
-                                       dis.ReadInt32();
-                               }
+                               dis.ReadInt32();
+                       }
 
-                               // first byte is the type of the packet
-                               byte dataType = dis.ReadByte();
-                               if(dataType != NULL_TYPE)
+                       // first byte is the type of the packet
+                       byte dataType = dis.ReadByte();
+
+                       if(dataType != NULL_TYPE)
+                       {
+                               lock(this.marshalLock)
                                {
                                        BaseDataStreamMarshaller dsm = 
dataMarshallers[dataType & 0xFF];
                                        if(null == dsm)
@@ -258,10 +259,10 @@
                                                return data;
                                        }
                                }
-                               else
-                               {
-                                       return null;
-                               }
+                       }
+                       else
+                       {
+                               return null;
                        }
                }
 

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/BooleanStreamTest.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/BooleanStreamTest.cs?rev=713243&r1=713242&r2=713243&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/BooleanStreamTest.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/BooleanStreamTest.cs
 Tue Nov 11 17:41:02 2008
@@ -124,7 +124,7 @@
                                dis.ReadByte();
                                Assert.Fail("Should have reached the end of the 
stream");
                        }
-                       catch(IOException)
+                       catch(EndOfStreamException)
                        {
                        }
                }


Reply via email to