geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick McGuire <rick...@gmail.com>
Subject Re: while(true) in getConnectedSSLSocket Method in SMTPTransport.java
Date Mon, 04 Dec 2006 21:31:43 GMT
Jason Warner wrote:
> Hey all,
>
> I was looking at the getConnectedSSLSocket method in the 
> SMTPTransport.java class for javamail and I was confused.  There is a 
> section that consists of a while loop whose condition is true.  Within 
> this while loop is code to create a socket connection with a server.  
> I am confused as to how this works.  Shouldn't there be some condition 
> such that if the socket has been connected then you break out of the 
> while loop?  I used this piece of code in the pop3Connection class for 
> establishing an SSL connection when using pop3.  When I try to run it 
> I get a bind exception.  I believe this is caused by that while loop 
> not being exited when the socket is created.  I can add in those break 
> statements but I was curious how it works for smtp.  There are no 
> break statements in that piece of code so I was wondering if there's 
> another way it works.  Is there a different reason why creating the 
> socket would break out of the while loop that I'm not encountering?  
> Thanks.
What you're seeing is code that's probably never been tested :-)   I 
suspect this has only ever been used with the non-factory version, and 
there should be a "break" right before the catch inside the loop.

Rick


>
> Jason


Mime
View raw message