1
|
|
#region Copyright
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
#endregion
|
18
|
|
|
19
|
|
using System;
|
20
|
|
using System.Runtime.Serialization;
|
21
|
|
using Seasar.Framework.Message;
|
22
|
|
|
23
|
|
namespace Seasar.Framework.Exceptions
|
24
|
|
{
|
25
|
|
|
26
|
|
|
27
|
|
|
28
|
|
|
29
|
|
[Serializable]
|
30
|
|
public class SRuntimeException : ApplicationException
|
31
|
|
{
|
32
|
|
private string messageCode_;
|
33
|
|
private object[] args_;
|
34
|
|
private string message_;
|
35
|
|
private string simpleMessage_;
|
36
|
|
|
37
|
0
|
public SRuntimeException(string messageCode)
|
38
|
|
: this(messageCode,null,null)
|
39
|
|
{
|
40
|
|
}
|
41
|
|
|
42
|
|
|
43
|
607
|
public SRuntimeException(string messageCode,object[] args)
|
44
|
|
: this(messageCode,args,null)
|
45
|
|
{
|
46
|
|
}
|
47
|
|
|
48
|
|
|
49
|
611
|
public SRuntimeException(string messageCode,object[] args,System.Exception cause)
|
50
|
|
: base(messageCode,cause)
|
51
|
|
{
|
52
|
611
|
messageCode_ = messageCode;
|
53
|
611
|
args_ = args;
|
54
|
611
|
simpleMessage_ = MessageFormatter.GetSimpleMessage(messageCode_,args_);
|
55
|
611
|
message_ = "[" + messageCode + "]" + simpleMessage_;
|
56
|
|
}
|
57
|
|
|
58
|
0
|
public SRuntimeException(SerializationInfo info, StreamingContext context )
|
59
|
|
: base( info, context )
|
60
|
|
{
|
61
|
|
this.messageCode_ = info.GetString("messageCode_");
|
62
|
|
this.args_ = info.GetValue("args_", typeof(object[])) as object[];
|
63
|
|
this.message_ = info.GetString("message_");
|
64
|
|
this.simpleMessage_ = info.GetString("simpleMessage_");
|
65
|
|
}
|
66
|
|
|
67
|
0
|
public override void GetObjectData( SerializationInfo info,
|
68
|
|
StreamingContext context )
|
69
|
|
{
|
70
|
|
info.AddValue("messageCode_", this.messageCode_, typeof(String));
|
71
|
|
info.AddValue("args_", this.args_, typeof(object[]));
|
72
|
|
info.AddValue("message_", this.message_, typeof(String));
|
73
|
|
info.AddValue("simpleMessage_", this.simpleMessage_, typeof(String));
|
74
|
|
|
75
|
|
base.GetObjectData(info, context);
|
76
|
|
}
|
77
|
|
|
78
|
|
|
79
|
|
public string MessageCode
|
80
|
|
{
|
81
|
1
|
get { return messageCode_; }
|
82
|
|
}
|
83
|
|
|
84
|
|
|
85
|
|
public object[] Args
|
86
|
|
{
|
87
|
2
|
get { return args_; }
|
88
|
|
}
|
89
|
|
|
90
|
|
public override string Message
|
91
|
|
{
|
92
|
18
|
get { return message_; }
|
93
|
|
}
|
94
|
|
|
95
|
|
|
96
|
0
|
public string SimpleMessage
|
97
|
|
{
|
98
|
|
get { return simpleMessage_; }
|
99
|
|
}
|
100
|
|
|
101
|
|
}
|
102
|
|
}
|
103
|
|
|