Skip to content
Permalink
Browse files
code cleanup
  • Loading branch information
Timothy A. Bish committed Sep 1, 2010
1 parent 92d4208 commit 2dc114a68071b8adda7adf5a21d455ce6fb20ef6
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 38 deletions.
@@ -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 @@ internal static object DeserializeObjFromMessage(IMessage message)
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 @@ private static Type GetRuntimeType(string typeName)
{
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())
{
@@ -241,7 +241,7 @@ public override void Write(double value)
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 @@ private uint CountUtf8Bytes(char[] chars)
return utfLength;
}

private void encodeUTF8toBuffer(char[] chars, byte[] buffer)
private static void encodeUTF8toBuffer(char[] chars, byte[] buffer)
{
int c = 0;
int count = 0;
@@ -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)
@@ -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()
{
}

@@ -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
@@ -368,7 +368,7 @@ public Uri toUri()
sb.Append(':');
}

if(host != null && host.Length != 0)
if(!string.IsNullOrEmpty(host))
{
sb.Append(host);
}
@@ -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 @@ public static object Deserialize(Type objType, string text)
/// #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

0 comments on commit 2dc114a

Please sign in to comment.