[prev in list] [next in list] [prev in thread] [next in thread]
List: log4net-dev
Subject: cvs commit: logging-log4net/src/Util SystemInfo.cs
From: nicko () apache ! org
Date: 2004-06-07 0:57:31
Message-ID: 20040607005731.52089.qmail () minotaur ! apache ! org
[Download RAW message or body]
nicko 2004/06/06 17:57:31
Modified: src/Util SystemInfo.cs
Log:
Make catches more specific where possible. Added method \
CreateArgumentOutOfRangeException
Revision Changes Path
1.5 +33 -2 logging-log4net/src/Util/SystemInfo.cs
Index: SystemInfo.cs
===================================================================
RCS file: /home/cvs/logging-log4net/src/Util/SystemInfo.cs,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- SystemInfo.cs 28 May 2004 21:30:02 -0000 1.4
+++ SystemInfo.cs 7 Jun 2004 00:57:31 -0000 1.5
@@ -166,7 +166,10 @@
// Lookup the host name
s_hostName = System.Net.Dns.GetHostName();
}
- catch
+ catch(System.Net.Sockets.SocketException)
+ {
+ }
+ catch(System.Security.SecurityException)
{
// We may get a security exception looking up the hostname
// You must have Unrestricted DnsPermission to access resource
@@ -181,7 +184,10 @@
s_hostName = Environment.MachineName;
#endif
}
- catch
+ catch(InvalidOperationException)
+ {
+ }
+ catch(System.Security.SecurityException)
{
// We may get a security exception looking up the machine name
// You must have Unrestricted EnvironmentPermission to access resource
@@ -520,6 +526,31 @@
return PocketGuid.NewGuid();
#else
return Guid.NewGuid();
+#endif
+ }
+
+ /// <summary>
+ /// Create a new instance of the <see cref="ArgumentOutOfRangeException"/> class \
+ /// with a specified error message, the parameter name, and the value
+ /// of the argument.
+ /// </summary>
+ /// <param name="parameterName">The name of the parameter that caused the \
exception</param> + /// <param name="actualValue">The value of the argument that \
causes this exception</param> + /// <param name="message">The message that \
describes the error</param> + /// <returns>the ArgumentOutOfRangeException \
object</returns> + /// <remarks>
+ /// <para>
+ /// The Compact Framework does not support the 3 parameter constructor for the
+ /// <see cref="ArgumentOutOfRangeException"/> type. This method provides an
+ /// implementation that works for all platforms.
+ /// </para>
+ /// </remarks>
+ public static ArgumentOutOfRangeException \
CreateArgumentOutOfRangeException(string parameterName, object actualValue, string \
message) + {
+#if NETCF
+ return new ArgumentOutOfRangeException(message + " param: " + parameterName + " \
value: " + actualValue); +#else
+ return new ArgumentOutOfRangeException(parameterName, actualValue, message);
#endif
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic