classpath-inetlib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Classpath-inetlib] Sending SMTP message gets stuck upon exception


From: Øyvind Harboe
Subject: Re: [Classpath-inetlib] Sending SMTP message gets stuck upon exception
Date: Sun, 25 Jan 2004 11:23:17 +0100

søn, 25.01.2004 kl. 09.13 skrev Chris Burdess: 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Øyvind Harboe wrote:
> > If an exception is thrown while an SMTP message body is being written,
> > the subsequent "QUIT" command is ignored because it is considered part 
> > of the
> > message body by the SMTP server. This eventually causes the app to wait
> > indefinitely for the QUIT command to complete.
> >
> > The patch attached is incomplete and is only intended for illustrative 
> > purposes.
> >
> > // application level code
> > try
> > {
> >     transport.sendMessage(message, message.getAllRecipients());
> > }
> > finally
> > {
> >     // executes QUIT command , but will hang indefinitely if
> >     // SMPTTransport.java mimeMessage.writeTo() throws e.g. a
> >     // runtime exception.
> >     transport.close();
> > }
> 
> You cannot assume that you can safely call any method on the transport, 
> including close(), after an I/O error. 

What should my code do then?

Isn't the "physical" SMTP connection still open? 

Garbage collection doesn't close it.


> If you can provide a good reason 
> why you think we /should/ be able to recover from such errors, let me 
> know and I'll look into it.

This API is defined by Sun AFAICT.

However, the API doc is not terribly  helpful in specifying whether or
not close() should be called in all cases.

http://java.sun.com/products/javamail/javadocs/javax/mail/Service.html#close()



> - -- 
> Chris Burdess
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (Darwin)
> 
> iD8DBQFAE3qv6dl1DEqHgrgRAhV6AJ91SCtzyoqGxFSSdHNi2BttfDpcaQCeIb2E
> ax26ouuWP12ysMmRNZZwyOw=
> =PdYG
> -----END PGP SIGNATURE-----





reply via email to

[Prev in Thread] Current Thread [Next in Thread]