You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/09/01 23:26:53 UTC
svn commit: r991710 - in
/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util: Convert.cs
EndianBinaryWriter.cs MessagePropertyIntercepter.cs
MessageTransformation.cs SessionUtils.cs URISupport.cs XmlUtils.cs
Author: tabish
Date: Wed Sep 1 21:26:52 2010
New Revision: 991710
URL: http://svn.apache.org/viewvc?rev=991710&view=rev
Log:
code cleanup
Modified:
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/Convert.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessageTransformation.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/URISupport.cs
activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/XmlUtils.cs
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/Convert.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/Convert.cs?rev=991710&r1=991709&r2=991710&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/Convert.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/Convert.cs Wed Sep 1 21:26:52 2010
@@ -1,18 +1,18 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
using System;
@@ -115,12 +115,12 @@ namespace Apache.NMS.Util
if(null == textMessage)
{
return null;
- }
-
- if(null == textMessage.NMSType || textMessage.NMSType.Length < 1)
- {
- Tracer.ErrorFormat("NMSType not set on message. Could not deserializing XML object.");
- return null;
+ }
+
+ if(string.IsNullOrEmpty(textMessage.NMSType))
+ {
+ Tracer.ErrorFormat("NMSType not set on message. Could not deserializing XML object.");
+ return null;
}
Type objType = GetRuntimeType(textMessage.NMSType);
@@ -143,8 +143,8 @@ namespace Apache.NMS.Util
{
Type objType = null;
-#if NETCF
- objType = Assembly.GetCallingAssembly().GetType(typeName, false);
+#if NETCF
+ objType = Assembly.GetCallingAssembly().GetType(typeName, false);
#else
foreach(Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
{
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs?rev=991710&r1=991709&r2=991710&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/EndianBinaryWriter.cs Wed Sep 1 21:26:52 2010
@@ -241,7 +241,7 @@ namespace Apache.NMS.Util
base.Write(EndianSupport.SwitchEndian(value));
}
- private uint CountUtf8Bytes(char[] chars)
+ private static uint CountUtf8Bytes(char[] chars)
{
uint utfLength = 0;
int c = 0;
@@ -266,7 +266,7 @@ namespace Apache.NMS.Util
return utfLength;
}
- private void encodeUTF8toBuffer(char[] chars, byte[] buffer)
+ private static void encodeUTF8toBuffer(char[] chars, byte[] buffer)
{
int c = 0;
int count = 0;
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs?rev=991710&r1=991709&r2=991710&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessagePropertyIntercepter.cs Wed Sep 1 21:26:52 2010
@@ -36,8 +36,8 @@ namespace Apache.NMS.Util
/// </summary>
public class MessagePropertyIntercepter : PrimitiveMapInterceptor
{
- private static BindingFlags publicBinding = BindingFlags.Public | BindingFlags.Instance;
- private Type messageType;
+ private const BindingFlags publicBinding = BindingFlags.Public | BindingFlags.Instance;
+ private readonly Type messageType;
public MessagePropertyIntercepter(IMessage message, IPrimitiveMap properties)
: base(message, properties)
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessageTransformation.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessageTransformation.cs?rev=991710&r1=991709&r2=991710&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessageTransformation.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/MessageTransformation.cs Wed Sep 1 21:26:52 2010
@@ -15,8 +15,6 @@
* limitations under the License.
*/
-using System;
-
namespace Apache.NMS.Util
{
/// <summary>
@@ -25,7 +23,7 @@ namespace Apache.NMS.Util
/// </summary>
public abstract class MessageTransformation
{
- public MessageTransformation()
+ protected MessageTransformation()
{
}
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs?rev=991710&r1=991709&r2=991710&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/SessionUtils.cs Wed Sep 1 21:26:52 2010
@@ -23,10 +23,10 @@ namespace Apache.NMS.Util
/// </summary>
public class SessionUtil
{
- private static string QueuePrefix = "queue://";
- private static string TopicPrefix = "topic://";
- private static string TempQueuePrefix = "temp-queue://";
- private static string TempTopicPrefix = "temp-topic://";
+ private const string QueuePrefix = "queue://";
+ private const string TopicPrefix = "topic://";
+ private const string TempQueuePrefix = "temp-queue://";
+ private const string TempTopicPrefix = "temp-topic://";
/// <summary>
/// Get the destination by parsing the embedded type prefix. Default is Queue if no prefix is
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/URISupport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/URISupport.cs?rev=991710&r1=991709&r2=991710&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/URISupport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/URISupport.cs Wed Sep 1 21:26:52 2010
@@ -368,7 +368,7 @@ namespace Apache.NMS.Util
sb.Append(':');
}
- if(host != null && host.Length != 0)
+ if(!string.IsNullOrEmpty(host))
{
sb.Append(host);
}
Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/XmlUtils.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/XmlUtils.cs?rev=991710&r1=991709&r2=991710&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/XmlUtils.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/main/csharp/Util/XmlUtils.cs Wed Sep 1 21:26:52 2010
@@ -29,7 +29,7 @@ namespace Apache.NMS.Util
/// </summary>
public class XmlUtil
{
- private static XmlWriterSettings xmlWriterSettings;
+ private static readonly XmlWriterSettings xmlWriterSettings;
/// <summary>
/// Static class constructor.
@@ -103,8 +103,8 @@ namespace Apache.NMS.Util
/// #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
/// any Unicode character, excluding the surrogate blocks, FFFE, and FFFF.
/// </summary>
- private static string invalidXMLMatch = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";
- private static Regex regexInvalidXMLChars = new Regex(invalidXMLMatch);
+ private const string invalidXMLMatch = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";
+ private static readonly Regex regexInvalidXMLChars = new Regex(invalidXMLMatch);
/// <summary>
/// This removes characters that are invalid for xml encoding