Donate Share

Dumbster

Tracker: Bugs

5 Dumbster fails to inform if it's stopped or not - ID: 1229248
Last Update: Comment added ( ddkilzer )

There's a bug inside the SimpleSmtpServer.run() method.
Dumbster works fine if the ServerSocket doesn't throw
an exception but if it does, the isStopped() method
will still return false while it should return true.
I'll try to explain the bug.

SimpleSmtpServer implements the Runnable interface and
in its start(int) method a new instance of himself is
passed to the Thread's constructor. This means that
when the Thread starts it will call
SimpleSmtpServer.run() that will try to instantiate a
new ServerSocket wich may throw an IOException. The
notifyAll() is then called allowing concurrent threads
(in this case the commons-email TestCases) to run. If
any exception is thrown then it will be captured inside
the run() method, we'll see a stack trace of the
problem and the run() method is over.

The problem is: if a socket cannot be opened the the
server is not running. There is no code setting the
stopped variable to true inside any catch block.

I suggest moving the first line of
SimpleSmtpServer.run() ("stopped = false") to somewhere
after the instantiation of the ServerSocket (inside the
same method).

Ramiro Pereira de Magalhães


Nobody/Anonymous ( nobody ) - 2005-06-28 19:12

5

Open

None

Jason Kitchen

None

None

Public


Comments ( 3 )




Date: 2006-04-25 18:11
Sender: ddkilzer

Logged In: YES
user_id=84089

See Patch 1476278 (Fix for Bug 1229248...fails to inform if
it's stopped or not) for a fix.

http://sourceforge.net/tracker/index.php?func=detail&aid=1476278&group_id=78413&atid=553188

Wouldn't it be nice if SourceForge had proper attachment
management so I could actually upload a patch to THIS
tracker item?



Date: 2006-04-25 17:44
Sender: ddkilzer

Logged In: YES
user_id=84089

Perhaps the SimpleSmtpServer.start() methods could also
return a null value if the server failed to start up, e.g.,
due to the socket already being bound. The start() methods
really shouldn't return an invalid object.



Date: 2005-07-13 03:05
Sender: jasonkitchenProject AdminAccepting Donations

Logged In: YES
user_id=752825

Thanks for researching and finding a solution. Will
integrate this into the next release.


Log in to comment.

Attached File

No Files Currently Attached

Change ( 1 )

Field Old Value Date By
assigned_to nobody 2005-07-13 03:05 jasonkitchen