Author: jgomes
Date: Thu Aug 21 16:51:38 2008
New Revision: 687903
URL: http://svn.apache.org/viewvc?rev=687903&view=rev
Log:
Add null check when assigning NMSReplyTo.
Refactored warnings of unused variables. Now has 100% error and warning free
compile.
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/EMSConvert.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BadConsumeTest.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/CommonAssemblyInfo.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
Thu Aug 21 16:51:38 2008
@@ -2,21 +2,20 @@
using System.Reflection;
using System.Runtime.InteropServices;
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
+//
------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+// Mono Runtime Version: 2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+//
------------------------------------------------------------------------------
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyTitleAttribute("Apache NMS for EMS Class Library")]
-[assembly: AssemblyDescriptionAttribute("Apache NMS for EMS Class Library
(.Net Messaging Library Implementation): An impl" +
- "ementation of the NMS API for EMS")]
+[assembly: AssemblyDescriptionAttribute("Apache NMS for EMS Class Library
(.Net Messaging Library Implementation): An implementation of the NMS API for
EMS")]
[assembly: AssemblyConfigurationAttribute("SNAPSHOT")]
[assembly: AssemblyCompanyAttribute("http://activemq.apache.org/nms")]
[assembly: AssemblyProductAttribute("Apache NMS for EMS Class Library")]
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/EMSConvert.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/EMSConvert.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/EMSConvert.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/EMSConvert.cs
Thu Aug 21 16:51:38 2008
@@ -14,7 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
using System;
+using System.Collections;
namespace Apache.NMS.EMS
{
@@ -23,61 +25,61 @@
public static Apache.NMS.IConnection
ToNMSConnection(TIBCO.EMS.Connection tibcoConnection)
{
return (null != tibcoConnection
- ? new
Apache.NMS.EMS.Connection(tibcoConnection)
- : null);
+ ? new
Apache.NMS.EMS.Connection(tibcoConnection)
+ : null);
}
public static Apache.NMS.ISession
ToNMSSession(TIBCO.EMS.Session tibcoSession)
{
return (null != tibcoSession
- ? new
Apache.NMS.EMS.Session(tibcoSession)
- : null);
+ ? new
Apache.NMS.EMS.Session(tibcoSession)
+ : null);
}
public static Apache.NMS.IMessageProducer
ToNMSMessageProducer(Apache.NMS.EMS.Session session,
TIBCO.EMS.MessageProducer
tibcoMessageProducer)
{
return (null != tibcoMessageProducer
- ? new
Apache.NMS.EMS.MessageProducer(session, tibcoMessageProducer)
- : null);
+ ? new
Apache.NMS.EMS.MessageProducer(session, tibcoMessageProducer)
+ : null);
}
public static Apache.NMS.IMessageConsumer
ToNMSMessageConsumer(Apache.NMS.EMS.Session session,
TIBCO.EMS.MessageConsumer
tibcoMessageConsumer)
{
return (null != tibcoMessageConsumer
- ? new
Apache.NMS.EMS.MessageConsumer(session, tibcoMessageConsumer)
- : null);
+ ? new
Apache.NMS.EMS.MessageConsumer(session, tibcoMessageConsumer)
+ : null);
}
public static Apache.NMS.IQueue ToNMSQueue(TIBCO.EMS.Queue
tibcoQueue)
{
return (null != tibcoQueue
- ? new
Apache.NMS.EMS.Queue(tibcoQueue)
- : null);
+ ? new
Apache.NMS.EMS.Queue(tibcoQueue)
+ : null);
}
public static Apache.NMS.ITopic ToNMSTopic(TIBCO.EMS.Topic
tibcoTopic)
{
return (null != tibcoTopic
- ? new
Apache.NMS.EMS.Topic(tibcoTopic)
- : null);
+ ? new
Apache.NMS.EMS.Topic(tibcoTopic)
+ : null);
}
public static Apache.NMS.ITemporaryQueue ToNMSTemporaryQueue(
TIBCO.EMS.TemporaryQueue tibcoTemporaryQueue)
{
return (null != tibcoTemporaryQueue
- ? new
Apache.NMS.EMS.TemporaryQueue(tibcoTemporaryQueue)
- : null);
+ ? new
Apache.NMS.EMS.TemporaryQueue(tibcoTemporaryQueue)
+ : null);
}
public static Apache.NMS.ITemporaryTopic ToNMSTemporaryTopic(
TIBCO.EMS.TemporaryTopic tibcoTemporaryTopic)
{
return (null != tibcoTemporaryTopic
- ? new
Apache.NMS.EMS.TemporaryTopic(tibcoTemporaryTopic)
- : null);
+ ? new
Apache.NMS.EMS.TemporaryTopic(tibcoTemporaryTopic)
+ : null);
}
public static Apache.NMS.IDestination
ToNMSDestination(TIBCO.EMS.Destination tibcoDestination)
@@ -128,38 +130,38 @@
}
return (null != tibcoMessage
- ? new
Apache.NMS.EMS.Message(tibcoMessage)
- : null);
+ ? new
Apache.NMS.EMS.Message(tibcoMessage)
+ : null);
}
public static Apache.NMS.ITextMessage
ToNMSTextMessage(TIBCO.EMS.TextMessage tibcoTextMessage)
{
return (null != tibcoTextMessage
- ? new
Apache.NMS.EMS.TextMessage(tibcoTextMessage)
- : null);
+ ? new
Apache.NMS.EMS.TextMessage(tibcoTextMessage)
+ : null);
}
public static Apache.NMS.IBytesMessage ToNMSBytesMessage(
TIBCO.EMS.BytesMessage tibcoBytesMessage)
{
return (null != tibcoBytesMessage
- ? new
Apache.NMS.EMS.BytesMessage(tibcoBytesMessage)
- : null);
+ ? new
Apache.NMS.EMS.BytesMessage(tibcoBytesMessage)
+ : null);
}
public static Apache.NMS.IMapMessage
ToNMSMapMessage(TIBCO.EMS.MapMessage tibcoMapMessage)
{
return (null != tibcoMapMessage
- ? new
Apache.NMS.EMS.MapMessage(tibcoMapMessage)
- : null);
+ ? new
Apache.NMS.EMS.MapMessage(tibcoMapMessage)
+ : null);
}
public static Apache.NMS.IObjectMessage ToNMSObjectMessage(
TIBCO.EMS.ObjectMessage tibcoObjectMessage)
{
return (null != tibcoObjectMessage
- ? new
Apache.NMS.EMS.ObjectMessage(tibcoObjectMessage)
- : null);
+ ? new
Apache.NMS.EMS.ObjectMessage(tibcoObjectMessage)
+ : null);
}
public static TIBCO.EMS.SessionMode
ToSessionMode(Apache.NMS.AcknowledgementMode acknowledge)
@@ -218,8 +220,8 @@
public static Apache.NMS.IPrimitiveMap
ToMessageProperties(TIBCO.EMS.Message tibcoMessage)
{
return (null != tibcoMessage
- ? new
Apache.NMS.EMS.MessageProperties(tibcoMessage)
- : null);
+ ? new
Apache.NMS.EMS.MessageProperties(tibcoMessage)
+ : null);
}
public static TIBCO.EMS.MessageDeliveryMode
ToMessageDeliveryMode(bool persistent)
@@ -233,5 +235,29 @@
{
return (TIBCO.EMS.MessageDeliveryMode.NonPersistent !=
deliveryMode);
}
+
+
+ #region Enumerable adapter
+
+ private class EnumerableAdapter : IEnumerable
+ {
+ private readonly IEnumerator enumerator;
+ public EnumerableAdapter(IEnumerator _enumerator)
+ {
+ this.enumerator = _enumerator;
+ }
+
+ public IEnumerator GetEnumerator()
+ {
+ return this.enumerator;
+ }
+ }
+
+ public static IEnumerable ToEnumerable(IEnumerator enumerator)
+ {
+ return new EnumerableAdapter(enumerator);
+ }
+
+ #endregion
}
-}
\ No newline at end of file
+}
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MapMessage.cs
Thu Aug 21 16:51:38 2008
@@ -42,20 +42,6 @@
#endregion
- private class MapEnumerable : IEnumerable
- {
- private readonly TIBCO.EMS.MapMessage tibcoMapMessage;
- public MapEnumerable(TIBCO.EMS.MapMessage message)
- {
- this.tibcoMapMessage = message;
- }
-
- public IEnumerator GetEnumerator()
- {
- return tibcoMapMessage.MapNames;
- }
- }
-
#region IPrimitiveMap Members
public void Clear()
@@ -79,11 +65,14 @@
get
{
int count = 0;
- MapEnumerable mapItems = new
MapEnumerable(this.tibcoMapMessage);
+ IEnumerator namesEnumerator =
this.tibcoMapMessage.MapNames;
- foreach(object item in mapItems)
+ if(null != namesEnumerator)
{
- count++;
+ while(namesEnumerator.MoveNext())
+ {
+ count++;
+ }
}
return count;
@@ -95,9 +84,8 @@
get
{
ArrayList keys = new ArrayList();
- MapEnumerable mapItems = new
MapEnumerable(this.tibcoMapMessage);
- foreach(string itemName in mapItems)
+ foreach(string itemName in
EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
{
keys.Add(itemName);
}
@@ -111,9 +99,8 @@
get
{
ArrayList keys = new ArrayList();
- MapEnumerable mapItems = new
MapEnumerable(this.tibcoMapMessage);
- foreach(string itemName in mapItems)
+ foreach(string itemName in
EMSConvert.ToEnumerable(this.tibcoMapMessage.MapNames))
{
keys.Add(this.tibcoMapMessage.GetObject(itemName));
}
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/Message.cs
Thu Aug 21 16:51:38 2008
@@ -138,7 +138,17 @@
public Apache.NMS.IDestination NMSReplyTo
{
get { return
EMSConvert.ToNMSDestination(this.tibcoMessage.ReplyTo); }
- set { this.tibcoMessage.ReplyTo =
((Apache.NMS.EMS.Destination) value).tibcoDestination; }
+ set
+ {
+ if(null == value)
+ {
+ this.tibcoMessage.ReplyTo = null;
+ }
+ else
+ {
+ this.tibcoMessage.ReplyTo =
((Apache.NMS.EMS.Destination) value).tibcoDestination;
+ }
+ }
}
/// <summary>
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/main/csharp/MessageProperties.cs
Thu Aug 21 16:51:38 2008
@@ -28,20 +28,6 @@
this.tibcoMessage = message;
}
- private class PropertyNameEnumerable : IEnumerable
- {
- private readonly TIBCO.EMS.Message tibcoMessage;
- public PropertyNameEnumerable(TIBCO.EMS.Message message)
- {
- this.tibcoMessage = message;
- }
-
- public IEnumerator GetEnumerator()
- {
- return tibcoMessage.PropertyNames;
- }
- }
-
#region IPrimitiveMap Members
public void Clear()
@@ -65,11 +51,14 @@
get
{
int count = 0;
- PropertyNameEnumerable propertyNames = new
PropertyNameEnumerable(this.tibcoMessage);
+ IEnumerator propertyNamesEnumerator =
this.tibcoMessage.PropertyNames;
- foreach(object propertyName in propertyNames)
+ if(null != propertyNamesEnumerator)
{
- count++;
+
while(propertyNamesEnumerator.MoveNext())
+ {
+ count++;
+ }
}
return count;
@@ -81,9 +70,8 @@
get
{
ArrayList keys = new ArrayList();
- PropertyNameEnumerable propertyNames = new
PropertyNameEnumerable(this.tibcoMessage);
- foreach(string propertyName in propertyNames)
+ foreach(string propertyName in
EMSConvert.ToEnumerable(this.tibcoMessage.PropertyNames))
{
keys.Add(propertyName);
}
@@ -97,9 +85,8 @@
get
{
ArrayList values = new ArrayList();
- PropertyNameEnumerable propertyNames = new
PropertyNameEnumerable(this.tibcoMessage);
- foreach(string propertyName in propertyNames)
+ foreach(string propertyName in
EMSConvert.ToEnumerable(this.tibcoMessage.PropertyNames))
{
values.Add(this.tibcoMessage.GetObjectProperty(propertyName));
}
Modified:
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/test/csharp/CommonAssemblyInfo.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS.EMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
Thu Aug 21 16:51:38 2008
@@ -2,21 +2,20 @@
using System.Reflection;
using System.Runtime.InteropServices;
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.1433
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
+//
------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+// Mono Runtime Version: 2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+//
------------------------------------------------------------------------------
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(false)]
[assembly: AssemblyTitleAttribute("Apache NMS for EMS Class Library")]
-[assembly: AssemblyDescriptionAttribute("Apache NMS for EMS Class Library
(.Net Messaging Library Implementation): An impl" +
- "ementation of the NMS API for EMS")]
+[assembly: AssemblyDescriptionAttribute("Apache NMS for EMS Class Library
(.Net Messaging Library Implementation): An implementation of the NMS API for
EMS")]
[assembly: AssemblyConfigurationAttribute("SNAPSHOT")]
[assembly: AssemblyCompanyAttribute("http://activemq.apache.org/nms")]
[assembly: AssemblyProductAttribute("Apache NMS for EMS Class Library")]
Modified:
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/CommonAssemblyInfo.cs
Thu Aug 21 16:51:38 2008
@@ -2,21 +2,20 @@
using System.Reflection;
using System.Runtime.InteropServices;
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
+//
------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+// Mono Runtime Version: 2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+//
------------------------------------------------------------------------------
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(true)]
[assembly: AssemblyTitleAttribute("Apache NMS Class Library")]
-[assembly: AssemblyDescriptionAttribute("Apache NMS (.Net Messaging Library):
An abstract interface to Message Oriented Mi" +
- "ddleware (MOM) providers")]
+[assembly: AssemblyDescriptionAttribute("Apache NMS (.Net Messaging Library):
An abstract interface to Message Oriented Middleware (MOM) providers")]
[assembly: AssemblyConfigurationAttribute("SNAPSHOT")]
[assembly: AssemblyCompanyAttribute("http://activemq.apache.org/nms")]
[assembly: AssemblyProductAttribute("Apache NMS Class Library")]
Modified:
activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BadConsumeTest.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BadConsumeTest.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BadConsumeTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/BadConsumeTest.cs
Thu Aug 21 16:51:38 2008
@@ -54,7 +54,7 @@
[ExpectedException(Handler="ExceptionValidationCheck")]
public void TestBadConsumerException()
{
- IMessageConsumer consumer =
session.CreateConsumer(null);
+ session.CreateConsumer(null);
}
public void ExceptionValidationCheck(Exception ex)
Modified:
activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
URL:
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs?rev=687903&r1=687902&r2=687903&view=diff
==============================================================================
---
activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
(original)
+++
activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/CommonAssemblyInfo.cs
Thu Aug 21 16:51:38 2008
@@ -2,21 +2,20 @@
using System.Reflection;
using System.Runtime.InteropServices;
-//------------------------------------------------------------------------------
-// <auto-generated>
-// This code was generated by a tool.
-// Runtime Version:2.0.50727.3053
-//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
+//
------------------------------------------------------------------------------
+// <autogenerated>
+// This code was generated by a tool.
+// Mono Runtime Version: 2.0.50727.42
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </autogenerated>
+//
------------------------------------------------------------------------------
[assembly: ComVisibleAttribute(false)]
[assembly: CLSCompliantAttribute(true)]
[assembly: AssemblyTitleAttribute("Apache NMS Class Library")]
-[assembly: AssemblyDescriptionAttribute("Apache NMS (.Net Messaging Library):
An abstract interface to Message Oriented Mi" +
- "ddleware (MOM) providers")]
+[assembly: AssemblyDescriptionAttribute("Apache NMS (.Net Messaging Library):
An abstract interface to Message Oriented Middleware (MOM) providers")]
[assembly: AssemblyConfigurationAttribute("SNAPSHOT")]
[assembly: AssemblyCompanyAttribute("http://activemq.apache.org/nms")]
[assembly: AssemblyProductAttribute("Apache NMS Class Library")]