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