I don't think so. Our general policy is to throw
proper .Net exception, instead
of java exception in case when it needed by API, however in case when
.Net
is not define any exception - we prefer to throw java exception - this
may be
more useful for user in order to understand and solve the problem.
(For example you will not put at any line of code try/catch of
java.lang.RuntimeException, java.lang.Error etc. - this in order to pop
up more
"beautiful" exception). I really don't understand why it "would be
better" to throw
SocketException in this case.
Ilya.
Konstantin Triger wrote:
Agreed,
but anyway, throwing SocketException would be better than
UnknownHostException
</jdk142/api/java/net/UnknownHostException.html>.
You can also suppress the exception and pass "localhost" instead.
Regards,
Konstantin Triger
Ilya Kharmatsky wrote:
In this case there is no "appropriate" throw.
May be I'm wrong, but
in .Net code there is no exception in this method.
Konstantin Triger wrote:
Hi Ilya,
It's worth to wrap the
"java.net.InetAddress address = java.net.InetAddress.getLocalHost();"
with an appropriate try/catch/throw, otherwise a Java exception would
be thrown to the user.
Regards,
Konstantin Triger
Ilya Kharmatsky wrote:
Please review the patch.
Thanks,
Ilya.
------------------------------------------------------------------------
Index: ChangeLog
===================================================================
--- ChangeLog (revision 45568)
+++ ChangeLog (working copy)
@@ -1,3 +1,9 @@
+2005-06-08 Ilya Kharmatsky <ilyak-at-mainsoft.com>
+
+ * SmtpMail.cs: Added TARGET_JVM directive in Send method,
+ where we will use in J2EE configuration the "native" java
+ support for obtaining the network address of localhost.
+ 2005-04-20 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
* SmtpClient.cs:
Index: SmtpMail.cs
===================================================================
--- SmtpMail.cs (revision 45614)
+++ SmtpMail.cs (working copy)
@@ -64,7 +64,17 @@
// access to properties and to add some functionality
MailMessageWrapper messageWrapper = new MailMessageWrapper(
message );
+#if TARGET_JVM
+ string currentSmtpServer = smtpServer;
+ if (currentSmtpServer == "localhost")
+ {
+ java.net.InetAddress address =
java.net.InetAddress.getLocalHost();
+ currentSmtpServer = address.getHostAddress();
+ }
+ SmtpClient smtp = new SmtpClient (currentSmtpServer);
+#else
SmtpClient smtp = new SmtpClient (smtpServer);
+#endif
smtp.Send (messageWrapper);
------------------------------------------------------------------------
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
|
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list