diff options
| author | Robert Greig <rgreig@apache.org> | 2007-01-05 10:26:09 +0000 |
|---|---|---|
| committer | Robert Greig <rgreig@apache.org> | 2007-01-05 10:26:09 +0000 |
| commit | 4bd746c40eb9094ce967ea8a3cebeec983de6b0b (patch) | |
| tree | 14fcd017e8a25dd36f24e5a21776d8fdb5ae4cf9 /qpid | |
| parent | 9baaa04848053dfa6877e603eccc6b0ba148103c (diff) | |
| download | qpid-python-4bd746c40eb9094ce967ea8a3cebeec983de6b0b.tar.gz | |
Patch for Qpid-246 applied. Makes exceptions serializable.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@492963 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
7 files changed, 70 insertions, 0 deletions
diff --git a/qpid/dotnet/Qpid.Buffer/BufferDataException.cs b/qpid/dotnet/Qpid.Buffer/BufferDataException.cs index 1c6c37e84f..bce2d7ef5a 100644 --- a/qpid/dotnet/Qpid.Buffer/BufferDataException.cs +++ b/qpid/dotnet/Qpid.Buffer/BufferDataException.cs @@ -19,6 +19,7 @@ * */ using System; +using System.Runtime.Serialization; namespace Qpid.Buffer { @@ -26,6 +27,7 @@ namespace Qpid.Buffer * A {@link RuntimeException} which is thrown when the data the {@link ByteBuffer} * contains is corrupt. */ + [Serializable] public class BufferDataException : Exception { public BufferDataException() @@ -43,5 +45,10 @@ namespace Qpid.Buffer public BufferDataException( Exception cause ) : base("", cause) { } + + protected BufferDataException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } diff --git a/qpid/dotnet/Qpid.Buffer/BufferOverflowException.cs b/qpid/dotnet/Qpid.Buffer/BufferOverflowException.cs index b5896262da..2a7ad064d5 100644 --- a/qpid/dotnet/Qpid.Buffer/BufferOverflowException.cs +++ b/qpid/dotnet/Qpid.Buffer/BufferOverflowException.cs @@ -19,14 +19,22 @@ * */ using System; +using System.Runtime.Serialization; namespace Qpid.Buffer { + [Serializable] public class BufferOverflowException : Exception { public BufferOverflowException(string message) : base(message) { } + + protected BufferOverflowException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } + diff --git a/qpid/dotnet/Qpid.Buffer/BufferUnderflowException.cs b/qpid/dotnet/Qpid.Buffer/BufferUnderflowException.cs index 9de6b6558f..c0cb850e63 100644 --- a/qpid/dotnet/Qpid.Buffer/BufferUnderflowException.cs +++ b/qpid/dotnet/Qpid.Buffer/BufferUnderflowException.cs @@ -19,15 +19,23 @@ * */ using System; +using System.Runtime.Serialization; namespace Qpid.Buffer { + [Serializable] public class BufferUnderflowException : Exception { public BufferUnderflowException(string message) : base(message) { } + + protected BufferUnderflowException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } + diff --git a/qpid/dotnet/Qpid.Client/Client/Failover/FailoverException.cs b/qpid/dotnet/Qpid.Client/Client/Failover/FailoverException.cs index b13b28a66b..e2bc5b8a71 100644 --- a/qpid/dotnet/Qpid.Client/Client/Failover/FailoverException.cs +++ b/qpid/dotnet/Qpid.Client/Client/Failover/FailoverException.cs @@ -19,6 +19,7 @@ * */ using System; +using System.Runtime.Serialization; namespace Qpid.Client.Failover { @@ -26,10 +27,16 @@ namespace Qpid.Client.Failover /// This exception is thrown when failover is taking place and we need to let other /// parts of the client know about this. /// </summary> + [Serializable] class FailoverException : Exception { public FailoverException(String message) : base(message) { } + + protected FailoverException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } diff --git a/qpid/dotnet/Qpid.Codec/ProtocolCodecException.cs b/qpid/dotnet/Qpid.Codec/ProtocolCodecException.cs index 797b475f19..a7d7bd9cb2 100644 --- a/qpid/dotnet/Qpid.Codec/ProtocolCodecException.cs +++ b/qpid/dotnet/Qpid.Codec/ProtocolCodecException.cs @@ -19,9 +19,11 @@ * */ using System; +using System.Runtime.Serialization; namespace Qpid.Codec { + [Serializable] public class ProtocolCodecException : Exception { public ProtocolCodecException() : base() @@ -35,6 +37,12 @@ namespace Qpid.Codec public ProtocolCodecException(Exception cause) : base("Codec Exception", cause) { } + + protected ProtocolCodecException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } + diff --git a/qpid/dotnet/Qpid.Common/AMQException.cs b/qpid/dotnet/Qpid.Common/AMQException.cs index 1b2f5a80bf..4c9c46946e 100644 --- a/qpid/dotnet/Qpid.Common/AMQException.cs +++ b/qpid/dotnet/Qpid.Common/AMQException.cs @@ -19,6 +19,7 @@ * */ using System; +using System.Runtime.Serialization; using log4net; namespace Qpid @@ -26,6 +27,7 @@ namespace Qpid /// <summary> /// The generic AMQ exception. /// </summary> + [Serializable] public class AMQException : Exception { private int _errorCode; @@ -105,6 +107,29 @@ namespace Qpid } /// <summary> + /// Serialization Constructor + /// </summary> + /// <param name="info">SerializationInfo object</param> + /// <param name="ctxt">StreamingContext object</param> + protected AMQException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + _errorCode = info.GetInt32("ErrorCode"); + } + + /// <summary> + /// ISerializable implementation of GetObjectData() + /// </summary> + /// <param name="info">SerializationInfo object</param> + /// <param name="ctxt">StreamingContext object</param> + public override void GetObjectData(SerializationInfo info, StreamingContext context) + { + base.GetObjectData(info, context); + info.AddValue("ErrorCode", _errorCode); + } + + + /// <summary> /// Gets or sets the error code. See RFC 006 for details of error codes. /// </summary> /// <value>The error code.</value> diff --git a/qpid/dotnet/Qpid.Messaging/QpidException.cs b/qpid/dotnet/Qpid.Messaging/QpidException.cs index 7f0c9873e5..dc3391898b 100644 --- a/qpid/dotnet/Qpid.Messaging/QpidException.cs +++ b/qpid/dotnet/Qpid.Messaging/QpidException.cs @@ -19,9 +19,11 @@ * */ using System; +using System.Runtime.Serialization; namespace Qpid.Messaging { + [Serializable] public class QpidException : Exception { public QpidException(string reason) : base(reason) @@ -32,5 +34,10 @@ namespace Qpid.Messaging : base(reason, e) { } + + protected QpidException(SerializationInfo info, StreamingContext ctxt) + : base(info, ctxt) + { + } } } |
