summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Greig <rgreig@apache.org>2007-01-05 17:00:41 +0000
committerRobert Greig <rgreig@apache.org>2007-01-05 17:00:41 +0000
commitc37fb7c4b27419cae13c45fb38e24506fd009ea4 (patch)
tree4c0a380c17f0406fe95aa2ece26d52759f200800
parent2d976b546f26b04f41606df6675f3217058d2d6f (diff)
downloadqpid-python-c37fb7c4b27419cae13c45fb38e24506fd009ea4.tar.gz
Qpid-246-2 patch applied. Adds serializability to exceptions missed by the first patch.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@493087 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--dotnet/Qpid.Client/Client/AMQConnectionException.cs9
-rw-r--r--dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs7
-rw-r--r--dotnet/Qpid.Client/Client/Message/UnexpectedBodyReceivedException.cs8
-rw-r--r--dotnet/Qpid.Client/Client/State/IllegalStateTransitionException.cs17
-rw-r--r--dotnet/Qpid.Client/qms/UrlSyntaxException.cs18
-rw-r--r--dotnet/Qpid.Codec/ProtocolDecoderException.cs17
-rw-r--r--dotnet/Qpid.Codec/ProtocolEncoderException.cs8
-rw-r--r--dotnet/Qpid.Common/AMQChannelClosedException.cs10
-rw-r--r--dotnet/Qpid.Common/AMQConnectionClosedException.cs10
-rw-r--r--dotnet/Qpid.Common/AMQDisconnectedException.cs10
-rw-r--r--dotnet/Qpid.Common/AMQUndeliveredException.cs18
-rw-r--r--dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs9
-rw-r--r--dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs10
-rw-r--r--dotnet/Qpid.Common/build.xml62
-rw-r--r--dotnet/Qpid.Messaging/ChannelLimitReachedException.cs17
-rw-r--r--dotnet/Qpid.Messaging/MessageNotReadableException.cs10
-rw-r--r--dotnet/Qpid.Messaging/MessageNotWritableException.cs9
-rw-r--r--dotnet/Qpid.Messaging/ResourceAllocationException.cs10
18 files changed, 230 insertions, 29 deletions
diff --git a/dotnet/Qpid.Client/Client/AMQConnectionException.cs b/dotnet/Qpid.Client/Client/AMQConnectionException.cs
index 603a7b2a1c..a4caf02e2c 100644
--- a/dotnet/Qpid.Client/Client/AMQConnectionException.cs
+++ b/dotnet/Qpid.Client/Client/AMQConnectionException.cs
@@ -19,13 +19,20 @@
*
*/
using System;
+using System.Runtime.Serialization;
namespace Qpid.Client
{
+ [Serializable]
public class AMQConnectionException : AMQException
{
public AMQConnectionException(String message, Exception e) : base(message, e)
{
}
+
+ protected AMQConnectionException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
-} \ No newline at end of file
+}
diff --git a/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs b/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs
index 8788856062..044dec58b1 100644
--- a/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs
+++ b/dotnet/Qpid.Client/Client/Message/QpidBytesMessage.cs
@@ -20,6 +20,7 @@
*/
using System;
using System.IO;
+using System.Runtime.Serialization;
using System.Text;
using Qpid.Framing;
using Qpid.Messaging;
@@ -27,11 +28,17 @@ using Qpid.Buffer;
namespace Qpid.Client.Message
{
+ [Serializable]
class MessageEOFException : QpidException
{
public MessageEOFException(string message) : base(message)
{
}
+
+ protected MessageEOFException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
public class QpidBytesMessage : AbstractQmsMessage, IBytesMessage
diff --git a/dotnet/Qpid.Client/Client/Message/UnexpectedBodyReceivedException.cs b/dotnet/Qpid.Client/Client/Message/UnexpectedBodyReceivedException.cs
index 679114d105..a671f608d1 100644
--- a/dotnet/Qpid.Client/Client/Message/UnexpectedBodyReceivedException.cs
+++ b/dotnet/Qpid.Client/Client/Message/UnexpectedBodyReceivedException.cs
@@ -19,6 +19,7 @@
*
*/
using System;
+using System.Runtime.Serialization;
using log4net;
namespace Qpid.Client.Message
@@ -27,6 +28,7 @@ namespace Qpid.Client.Message
/// Raised when a message body is received unexpectedly by the client. This typically occurs when the
/// length of bodies received does not match with the declared length in the content header.
/// </summary>
+ [Serializable]
public class UnexpectedBodyReceivedException : AMQException
{
public UnexpectedBodyReceivedException(ILog logger, string msg, Exception t)
@@ -43,6 +45,12 @@ namespace Qpid.Client.Message
: base(logger, errorCode, msg)
{
}
+
+ protected UnexpectedBodyReceivedException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
+
diff --git a/dotnet/Qpid.Client/Client/State/IllegalStateTransitionException.cs b/dotnet/Qpid.Client/Client/State/IllegalStateTransitionException.cs
index 723ae04397..86b625951e 100644
--- a/dotnet/Qpid.Client/Client/State/IllegalStateTransitionException.cs
+++ b/dotnet/Qpid.Client/Client/State/IllegalStateTransitionException.cs
@@ -19,9 +19,11 @@
*
*/
using System;
+using System.Runtime.Serialization;
namespace Qpid.Client.State
{
+ [Serializable]
public class IllegalStateTransitionException : AMQException
{
private AMQState _originalState;
@@ -36,6 +38,13 @@ namespace Qpid.Client.State
_frame = frame;
}
+ protected IllegalStateTransitionException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ _originalState = (AMQState)info.GetValue("OriginalState", typeof(AMQState));
+ _frame = (Type)info.GetValue("FrameType", typeof(Type));
+ }
+
public AMQState OriginalState
{
get
@@ -51,6 +60,14 @@ namespace Qpid.Client.State
return _frame;
}
}
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ info.AddValue("OriginalState", OriginalState);
+ info.AddValue("FrameType", FrameType);
+ }
}
}
+
diff --git a/dotnet/Qpid.Client/qms/UrlSyntaxException.cs b/dotnet/Qpid.Client/qms/UrlSyntaxException.cs
index f7aaf56085..e6da62a829 100644
--- a/dotnet/Qpid.Client/qms/UrlSyntaxException.cs
+++ b/dotnet/Qpid.Client/qms/UrlSyntaxException.cs
@@ -19,10 +19,12 @@
*
*/
using System;
+using System.Runtime.Serialization;
using System.Text;
namespace Qpid.Client.qms
{
+ [Serializable]
public class UrlSyntaxException : UriFormatException
{
private string _url;
@@ -53,6 +55,22 @@ namespace Qpid.Client.qms
_length = length;
}
+ protected UrlSyntaxException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ _url = info.GetString("Url");
+ _index = info.GetInt32("Index");
+ _length = info.GetInt32("Length");
+ }
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ info.AddValue("Url", _url);
+ info.AddValue("Index", _index);
+ info.AddValue("Length", _length);
+ }
+
private static String getPositionString(int index, int length)
{
StringBuilder sb = new StringBuilder(index + 1);
diff --git a/dotnet/Qpid.Codec/ProtocolDecoderException.cs b/dotnet/Qpid.Codec/ProtocolDecoderException.cs
index 94f3e6a591..562145288c 100644
--- a/dotnet/Qpid.Codec/ProtocolDecoderException.cs
+++ b/dotnet/Qpid.Codec/ProtocolDecoderException.cs
@@ -19,9 +19,11 @@
*
*/
using System;
+using System.Runtime.Serialization;
namespace Qpid.Codec
{
+ [Serializable]
public class ProtocolDecoderException : ProtocolCodecException
{
private string _hexdump;
@@ -37,7 +39,13 @@ namespace Qpid.Codec
public ProtocolDecoderException(Exception cause) : base(cause)
{
}
-
+
+ protected ProtocolDecoderException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ _hexdump = info.GetString("HexDump");
+ }
+
public string HexDump
{
get
@@ -49,6 +57,13 @@ namespace Qpid.Codec
_hexdump = value;
}
}
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ info.AddValue("HexDump", _hexdump);
+ }
}
}
+
diff --git a/dotnet/Qpid.Codec/ProtocolEncoderException.cs b/dotnet/Qpid.Codec/ProtocolEncoderException.cs
index db589c6c00..801cacbd54 100644
--- a/dotnet/Qpid.Codec/ProtocolEncoderException.cs
+++ b/dotnet/Qpid.Codec/ProtocolEncoderException.cs
@@ -19,9 +19,11 @@
*
*/
using System;
+using System.Runtime.Serialization;
namespace Qpid.Codec
{
+ [Serializable]
public class ProtocolEncoderException : ProtocolCodecException
{
public ProtocolEncoderException() : base()
@@ -35,6 +37,12 @@ namespace Qpid.Codec
public ProtocolEncoderException(Exception cause) : base(cause)
{
}
+
+ protected ProtocolEncoderException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
+
diff --git a/dotnet/Qpid.Common/AMQChannelClosedException.cs b/dotnet/Qpid.Common/AMQChannelClosedException.cs
index 957e3b627d..77d8c06802 100644
--- a/dotnet/Qpid.Common/AMQChannelClosedException.cs
+++ b/dotnet/Qpid.Common/AMQChannelClosedException.cs
@@ -18,13 +18,23 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid
{
+ [Serializable]
public class AMQChannelClosedException : AMQException
{
public AMQChannelClosedException(int errorCode, string message)
: base(errorCode, message)
{
}
+
+ protected AMQChannelClosedException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
diff --git a/dotnet/Qpid.Common/AMQConnectionClosedException.cs b/dotnet/Qpid.Common/AMQConnectionClosedException.cs
index 06d30e3d0a..977dcee73a 100644
--- a/dotnet/Qpid.Common/AMQConnectionClosedException.cs
+++ b/dotnet/Qpid.Common/AMQConnectionClosedException.cs
@@ -18,13 +18,23 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid
{
+ [Serializable]
public class AMQConnectionClosedException : AMQException
{
public AMQConnectionClosedException(int errorCode, string message)
: base(errorCode, message)
{
}
+
+ protected AMQConnectionClosedException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
diff --git a/dotnet/Qpid.Common/AMQDisconnectedException.cs b/dotnet/Qpid.Common/AMQDisconnectedException.cs
index e7cb2ff590..5ea9672839 100644
--- a/dotnet/Qpid.Common/AMQDisconnectedException.cs
+++ b/dotnet/Qpid.Common/AMQDisconnectedException.cs
@@ -18,8 +18,13 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid
{
+ [Serializable]
public class AMQDisconnectedException : AMQException
{
public AMQDisconnectedException(int errorCode, string message)
@@ -31,5 +36,10 @@ namespace Qpid
: base(message)
{
}
+
+ protected AMQDisconnectedException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
diff --git a/dotnet/Qpid.Common/AMQUndeliveredException.cs b/dotnet/Qpid.Common/AMQUndeliveredException.cs
index 1cbc56c0ce..225a94e9b8 100644
--- a/dotnet/Qpid.Common/AMQUndeliveredException.cs
+++ b/dotnet/Qpid.Common/AMQUndeliveredException.cs
@@ -18,13 +18,19 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid
{
/// <summary>
/// Thrown when a message has been bounced by the broker, indicating it could not be delivered.
/// </summary>
+ [Serializable]
public class AMQUndeliveredException : AMQException
{
+ // TODO: Warning, no guarantee that the value stored here is serializable!
private object _bounced;
public AMQUndeliveredException(int errorCode, string message, object bounced)
@@ -33,6 +39,18 @@ namespace Qpid
_bounced = bounced;
}
+ protected AMQUndeliveredException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ _bounced = info.GetValue("bounced", typeof(object));
+ }
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ info.AddValue("bounced", _bounced);
+ }
+
public object GetUndeliveredMessage()
{
return _bounced;
diff --git a/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs b/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs
index e7223c9850..82891b5986 100644
--- a/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs
+++ b/dotnet/Qpid.Common/Framing/AMQFrameDecodingException.cs
@@ -19,6 +19,7 @@
*
*/
using System;
+using System.Runtime.Serialization;
using log4net;
namespace Qpid.Framing
@@ -27,6 +28,7 @@ namespace Qpid.Framing
/// Thrown when a frame cannot be decoded. This generally indicates a mismatch between the broker and the
/// client.
/// </summary>
+ [Serializable]
public class AMQFrameDecodingException : AMQException
{
public AMQFrameDecodingException(string message)
@@ -47,6 +49,11 @@ namespace Qpid.Framing
public AMQFrameDecodingException(ILog logger, string message, Exception innerException)
: base(logger, message, innerException)
{
- }
+ }
+
+ protected AMQFrameDecodingException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
diff --git a/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs b/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs
index 7ea509c78a..555cf1e6af 100644
--- a/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs
+++ b/dotnet/Qpid.Common/Framing/AMQProtocolHeaderException.cs
@@ -18,12 +18,22 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid.Framing
{
+ [Serializable]
public class AMQProtocolHeaderException : AMQException
{
public AMQProtocolHeaderException(string message) : base(message)
{
}
+
+ protected AMQProtocolHeaderException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
diff --git a/dotnet/Qpid.Common/build.xml b/dotnet/Qpid.Common/build.xml
index fa3dd50338..e976859b15 100644
--- a/dotnet/Qpid.Common/build.xml
+++ b/dotnet/Qpid.Common/build.xml
@@ -1,15 +1,9 @@
+<!--
+ This sole purpose of this build script is to generate the framing layer for the .net client from the AMQ spec.
+ -->
<project name="AMQ Dot Net Framing Layer" default="generate">
- <property name="amq.home" value="../../.."/>
- <path id="amq.home.path">
- <pathelement location="${amq.home}"/>
- </path>
- <pathconvert targetos="unix" property="amq.home.fixed" refid="amq.home.path"/>
-
-<!--
- <property name="amq.asl" value="${amq.home.fixed}/amqp.org/specs/amqp.xml"/>
--->
- <property name="amq.asl" value="amqp.xml"/>
+ <property name="amq.home" value="../.."/>
<property name="stylesheet" value="stylesheets/framing.xsl"/>
<property name="registry_stylesheet" value="stylesheets/registry.xsl"/>
@@ -20,25 +14,42 @@
<property name="resources" value="resources"/>
<property name="base.lib" value="lib"/>
- <path id="project.classpath">
- <fileset dir="${base.lib}">
- <include name="**/*.jar"/>
- </fileset>
+ <path id="amq.home.path">
+ <pathelement location="${amq.home}"/>
</path>
- <target name="prepare">
- <mkdir dir="classes"/>
- </target>
+ <pathconvert targetos="unix" property="amq.home.fixed" refid="amq.home.path"/>
- <target name="regenerate" depends="clean, generate" description="generates code">
+<!-- Some spec changes break the build, reverting to private copy in Qpid.Common temporarily till this is fixed. -->
+<!-- <property name="amq.asl" value="${amq.home.fixed}/specs/amqp.0-8.xml"/> -->
+ <property name="amq.asl" value="amqp.xml"/>
+
+ <target name="clean" description="Deletes the generated sources.">
+ <delete>
+ <fileset dir="${generated.src}" includes="**/*"/>
+ </delete>
</target>
- <target name="check-generate">
- <uptodate property="generateNotRequired" targetfile="${generated.src}/results.out" srcfile="${amq.asl}"/>
+ <!--
+ Checks if the generation step needs to be performed. It will be skipped if the sources are up to date with the spec and provided that the
+ force flag has not been set.
+ -->
+ <target name="check-generate"
+ description="Checks if the generated sources are up-to-date. Use -Dforce=true or the 'forcegen' target to force generation.">
+
+ <condition property="generateNotRequired">
+ <and>
+ <uptodate targetfile="${generated.src}/results.out" srcfile="${amq.asl}"/>
+ <not><isset property="force"/></not>
+ </and>
+ </condition>
</target>
- <target name="generate" depends="check-generate" unless="${generateNotRequired}" description="generates code">
+ <!-- Applies a transformation to the AMQP spec to generate the framing layer. -->
+ <target name="generate" depends="check-generate" unless="generateNotRequired" description="generates code">
+
<mkdir dir="${generated.src}"/>
+
<java jar="${saxon.jar}" fork="true">
<arg value="-o"/>
<arg value="${generated.src}/results.out"/>
@@ -47,6 +58,7 @@
<arg value="asl_base=${asl.base}"/>
<arg value="registry_name=MainRegistry"/>
</java>
+
<java jar="${saxon.jar}" fork="true">
<arg value="-o"/>
<arg value="${generated.src}/registry.out"/>
@@ -55,10 +67,8 @@
</java>
</target>
- <target name="clean" depends="prepare" description="deletes any products of the compile and generate tasks">
- <delete>
- <fileset dir="classes" includes="**/*"/>
- <fileset dir="${generated.src}" includes="**/*"/>
- </delete>
+ <!-- Does a clean and forces re-generation of the sources. -->
+ <target name="forcegen" depends="clean, generate" description="Forces clean re-generation of the code.">
</target>
+
</project>
diff --git a/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs b/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs
index 645c0d0cdd..0cfd2f24bc 100644
--- a/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs
+++ b/dotnet/Qpid.Messaging/ChannelLimitReachedException.cs
@@ -18,8 +18,13 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid.Messaging
{
+ [Serializable]
public class ChannelLimitReachedException : ResourceAllocationException
{
private long _limit;
@@ -32,6 +37,12 @@ namespace Qpid.Messaging
_limit = limit;
}
+ protected ChannelLimitReachedException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ _limit = info.GetInt64("Limit");
+ }
+
public long Limit
{
get
@@ -39,5 +50,11 @@ namespace Qpid.Messaging
return _limit;
}
}
+
+ public override void GetObjectData(SerializationInfo info, StreamingContext context)
+ {
+ base.GetObjectData(info, context);
+ info.AddValue("Limit", _limit);
+ }
}
}
diff --git a/dotnet/Qpid.Messaging/MessageNotReadableException.cs b/dotnet/Qpid.Messaging/MessageNotReadableException.cs
index 077a15e719..5a919c2ced 100644
--- a/dotnet/Qpid.Messaging/MessageNotReadableException.cs
+++ b/dotnet/Qpid.Messaging/MessageNotReadableException.cs
@@ -18,12 +18,22 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid.Messaging
{
+ [Serializable]
public class MessageNotReadableException : QpidException
{
public MessageNotReadableException(string reason) : base(reason)
{
}
+
+ protected MessageNotReadableException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
diff --git a/dotnet/Qpid.Messaging/MessageNotWritableException.cs b/dotnet/Qpid.Messaging/MessageNotWritableException.cs
index 26905e28f3..6d4068c8c4 100644
--- a/dotnet/Qpid.Messaging/MessageNotWritableException.cs
+++ b/dotnet/Qpid.Messaging/MessageNotWritableException.cs
@@ -18,12 +18,21 @@
* under the License.
*
*/
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid.Messaging
{
+ [Serializable]
public class MessageNotWriteableException : QpidException
{
public MessageNotWriteableException(string reason) : base(reason)
{
}
+
+ protected MessageNotWriteableException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}
diff --git a/dotnet/Qpid.Messaging/ResourceAllocationException.cs b/dotnet/Qpid.Messaging/ResourceAllocationException.cs
index 076e374d60..a208b3cbbb 100644
--- a/dotnet/Qpid.Messaging/ResourceAllocationException.cs
+++ b/dotnet/Qpid.Messaging/ResourceAllocationException.cs
@@ -18,12 +18,22 @@
* under the License.
*
*/
+
+using System;
+using System.Runtime.Serialization;
+
namespace Qpid.Messaging
{
+ [Serializable]
public class ResourceAllocationException : QpidException
{
public ResourceAllocationException(string reason) : base(reason)
{
}
+
+ protected ResourceAllocationException(SerializationInfo info, StreamingContext ctxt)
+ : base(info, ctxt)
+ {
+ }
}
}