[Mono-devel-list] System.Web/System.Web.Mail - patch (code synchronization between Mono and Mainsoft)

Ilya Kharmatsky ilyak at mainsoft.com
Mon Jun 13 12:59:30 EDT 2005


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 <gonzalo at ximian.com>
>>>>
>>>>     * 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 at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>>>  
>>>>
>>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050613/ce1440b8/attachment.html 


More information about the Mono-devel-list mailing list