Skip to content

Commit 6a939be

Browse files
committed
Add Platform method for getting the type name of an object
1 parent cead3ac commit 6a939be

File tree

252 files changed

+559
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+559
-333
lines changed

crypto/src/asn1/Asn1OctetString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static Asn1OctetString GetInstance(object obj)
5252
if (obj is Asn1TaggedObject)
5353
return GetInstance(((Asn1TaggedObject)obj).GetObject());
5454

55-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
55+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
5656
}
5757

5858
/**

crypto/src/asn1/Asn1Sequence.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static Asn1Sequence GetInstance(
5050
}
5151
}
5252

53-
throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj");
53+
throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
5454
}
5555

5656
/**
@@ -103,7 +103,7 @@ public static Asn1Sequence GetInstance(
103103
return (Asn1Sequence) inner;
104104
}
105105

106-
throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj");
106+
throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
107107
}
108108

109109
protected internal Asn1Sequence(

crypto/src/asn1/Asn1Set.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public static Asn1Set GetInstance(
5555
}
5656
}
5757

58-
throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj");
58+
throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
5959
}
6060

6161
/**
@@ -121,7 +121,7 @@ public static Asn1Set GetInstance(
121121
return new DerSet(v, false);
122122
}
123123

124-
throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj");
124+
throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
125125
}
126126

127127
protected internal Asn1Set(

crypto/src/asn1/Asn1TaggedObject.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static public Asn1TaggedObject GetInstance(
3737
return (Asn1TaggedObject) obj;
3838
}
3939

40-
throw new ArgumentException("Unknown object in GetInstance: " + obj.GetType().FullName, "obj");
40+
throw new ArgumentException("Unknown object in GetInstance: " + Platform.GetTypeName(obj), "obj");
4141
}
4242

4343
/**

crypto/src/asn1/BerTaggedObject.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ internal override void Encode(
8282
}
8383
else
8484
{
85-
throw Platform.CreateNotImplementedException(obj.GetType().Name);
85+
throw Platform.CreateNotImplementedException(Platform.GetTypeName(obj));
8686
}
8787

8888
foreach (Asn1Encodable o in eObj)

crypto/src/asn1/DerBMPString.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
using Org.BouncyCastle.Utilities;
4+
35
namespace Org.BouncyCastle.Asn1
46
{
57
/**
@@ -24,7 +26,7 @@ public static DerBmpString GetInstance(
2426
return (DerBmpString)obj;
2527
}
2628

27-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
29+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
2830
}
2931

3032
/**

crypto/src/asn1/DerBitString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static DerBitString GetInstance(
2929
return (DerBitString) obj;
3030
}
3131

32-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
32+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
3333
}
3434

3535
/**

crypto/src/asn1/DerBoolean.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
using Org.BouncyCastle.Utilities;
4+
35
namespace Org.BouncyCastle.Asn1
46
{
57
public class DerBoolean
@@ -23,7 +25,7 @@ public static DerBoolean GetInstance(
2325
return (DerBoolean) obj;
2426
}
2527

26-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
28+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
2729
}
2830

2931
/**

crypto/src/asn1/DerEnumerated.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static DerEnumerated GetInstance(
2323
return (DerEnumerated)obj;
2424
}
2525

26-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
26+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
2727
}
2828

2929
/**

crypto/src/asn1/DerGeneralString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public static DerGeneralString GetInstance(
1919
}
2020

2121
throw new ArgumentException("illegal object in GetInstance: "
22-
+ obj.GetType().Name);
22+
+ Platform.GetTypeName(obj));
2323
}
2424

2525
public static DerGeneralString GetInstance(

crypto/src/asn1/DerGeneralizedTime.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static DerGeneralizedTime GetInstance(
2727
return (DerGeneralizedTime)obj;
2828
}
2929

30-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name, "obj");
30+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj), "obj");
3131
}
3232

3333
/**

crypto/src/asn1/DerIA5String.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static DerIA5String GetInstance(
2626
return (DerIA5String)obj;
2727
}
2828

29-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
29+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
3030
}
3131

3232
/**

crypto/src/asn1/DerInteger.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static DerInteger GetInstance(
2323
return (DerInteger)obj;
2424
}
2525

26-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
26+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
2727
}
2828

2929
/**

crypto/src/asn1/DerNumericString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static DerNumericString GetInstance(
2626
return (DerNumericString)obj;
2727
}
2828

29-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
29+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
3030
}
3131

3232
/**

crypto/src/asn1/DerObjectIdentifier.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static DerObjectIdentifier GetInstance(object obj)
2626
return (DerObjectIdentifier) obj;
2727
if (obj is byte[])
2828
return FromOctetString((byte[])obj);
29-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name, "obj");
29+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj), "obj");
3030
}
3131

3232
/**

crypto/src/asn1/DerPrintableString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public static DerPrintableString GetInstance(
2626
return (DerPrintableString)obj;
2727
}
2828

29-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
29+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
3030
}
3131

3232
/**

crypto/src/asn1/DerT61String.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public static DerT61String GetInstance(
2525
return (DerT61String)obj;
2626
}
2727

28-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
28+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
2929
}
3030

3131
/**

crypto/src/asn1/DerUTCTime.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public static DerUtcTime GetInstance(
2727
return (DerUtcTime)obj;
2828
}
2929

30-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
30+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
3131
}
3232

3333
/**

crypto/src/asn1/DerUTF8String.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Text;
33

4+
using Org.BouncyCastle.Utilities;
5+
46
namespace Org.BouncyCastle.Asn1
57
{
68
/**
@@ -24,7 +26,7 @@ public static DerUtf8String GetInstance(
2426
return (DerUtf8String)obj;
2527
}
2628

27-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
29+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
2830
}
2931

3032
/**

crypto/src/asn1/DerUniversalString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public static DerUniversalString GetInstance(
2828
return (DerUniversalString)obj;
2929
}
3030

31-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
31+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
3232
}
3333

3434
/**

crypto/src/asn1/DerVisibleString.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public static DerVisibleString GetInstance(
3636
return GetInstance(((Asn1TaggedObject)obj).GetObject());
3737
}
3838

39-
throw new ArgumentException("illegal object in GetInstance: " + obj.GetType().Name);
39+
throw new ArgumentException("illegal object in GetInstance: " + Platform.GetTypeName(obj));
4040
}
4141

4242
/**

crypto/src/asn1/cmp/CAKeyUpdAnnContent.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
using Org.BouncyCastle.Utilities;
4+
35
namespace Org.BouncyCastle.Asn1.Cmp
46
{
57
public class CAKeyUpdAnnContent
@@ -24,7 +26,7 @@ public static CAKeyUpdAnnContent GetInstance(object obj)
2426
if (obj is Asn1Sequence)
2527
return new CAKeyUpdAnnContent((Asn1Sequence)obj);
2628

27-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
29+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
2830
}
2931

3032
public virtual CmpCertificate OldWithNew

crypto/src/asn1/cmp/CertConfirmContent.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
using Org.BouncyCastle.Utilities;
4+
35
namespace Org.BouncyCastle.Asn1.Cmp
46
{
57
public class CertConfirmContent
@@ -20,7 +22,7 @@ public static CertConfirmContent GetInstance(object obj)
2022
if (obj is Asn1Sequence)
2123
return new CertConfirmContent((Asn1Sequence)obj);
2224

23-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
25+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
2426
}
2527

2628
public virtual CertStatus[] ToCertStatusArray()

crypto/src/asn1/cmp/CertOrEncCert.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22

33
using Org.BouncyCastle.Asn1.Crmf;
4+
using Org.BouncyCastle.Utilities;
45

56
namespace Org.BouncyCastle.Asn1.Cmp
67
{
@@ -34,7 +35,7 @@ public static CertOrEncCert GetInstance(object obj)
3435
if (obj is Asn1TaggedObject)
3536
return new CertOrEncCert((Asn1TaggedObject)obj);
3637

37-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
38+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
3839
}
3940

4041
public CertOrEncCert(CmpCertificate certificate)

crypto/src/asn1/cmp/CertRepMessage.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
using Org.BouncyCastle.Utilities;
4+
35
namespace Org.BouncyCastle.Asn1.Cmp
46
{
57
public class CertRepMessage
@@ -28,7 +30,7 @@ public static CertRepMessage GetInstance(object obj)
2830
if (obj is Asn1Sequence)
2931
return new CertRepMessage((Asn1Sequence)obj);
3032

31-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
33+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
3234
}
3335

3436
public CertRepMessage(CmpCertificate[] caPubs, CertResponse[] response)

crypto/src/asn1/cmp/CertResponse.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22

3+
using Org.BouncyCastle.Utilities;
4+
35
namespace Org.BouncyCastle.Asn1.Cmp
46
{
57
public class CertResponse
@@ -45,7 +47,7 @@ public static CertResponse GetInstance(object obj)
4547
if (obj is Asn1Sequence)
4648
return new CertResponse((Asn1Sequence)obj);
4749

48-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
50+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
4951
}
5052

5153
public CertResponse(

crypto/src/asn1/cmp/CertStatus.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22

33
using Org.BouncyCastle.Math;
4+
using Org.BouncyCastle.Utilities;
45

56
namespace Org.BouncyCastle.Asn1.Cmp
67
{
@@ -43,7 +44,7 @@ public static CertStatus GetInstance(object obj)
4344
if (obj is Asn1Sequence)
4445
return new CertStatus((Asn1Sequence)obj);
4546

46-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
47+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
4748
}
4849

4950
public virtual Asn1OctetString CertHash

crypto/src/asn1/cmp/CertifiedKeyPair.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22

33
using Org.BouncyCastle.Asn1.Crmf;
4+
using Org.BouncyCastle.Utilities;
45

56
namespace Org.BouncyCastle.Asn1.Cmp
67
{
@@ -45,7 +46,7 @@ public static CertifiedKeyPair GetInstance(object obj)
4546
if (obj is Asn1Sequence)
4647
return new CertifiedKeyPair((Asn1Sequence)obj);
4748

48-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
49+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
4950
}
5051

5152
public CertifiedKeyPair(

crypto/src/asn1/cmp/Challenge.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22

33
using Org.BouncyCastle.Asn1.X509;
4+
using Org.BouncyCastle.Utilities;
45

56
namespace Org.BouncyCastle.Asn1.Cmp
67
{
@@ -32,7 +33,7 @@ public static Challenge GetInstance(object obj)
3233
if (obj is Asn1Sequence)
3334
return new Challenge((Asn1Sequence)obj);
3435

35-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
36+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
3637
}
3738

3839
public virtual AlgorithmIdentifier Owf

crypto/src/asn1/cmp/CmpCertificate.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22

33
using Org.BouncyCastle.Asn1.X509;
4+
using Org.BouncyCastle.Utilities;
45

56
namespace Org.BouncyCastle.Asn1.Cmp
67
{
@@ -37,7 +38,7 @@ public static CmpCertificate GetInstance(object obj)
3738
if (obj is Asn1TaggedObject)
3839
return new CmpCertificate(AttributeCertificate.GetInstance(((Asn1TaggedObject)obj).GetObject()));
3940

40-
throw new ArgumentException("Invalid object: " + obj.GetType().Name, "obj");
41+
throw new ArgumentException("Invalid object: " + Platform.GetTypeName(obj), "obj");
4142
}
4243

4344
public virtual bool IsX509v3PKCert

0 commit comments

Comments
 (0)