Skip to main content

Please review fix for CR 6830630

2 replies [Last post]
sergey_borodin
Offline
Joined: 2006-10-20
Points: 0

"ServiceManager.stopServices() throws NullPointerException".
Description:
ServiceManager throws NullPointerException in stopServices() method in the line:
harness.removeObserver(this);
It happens if user cancels test run when the last test of the run has been started already. In this case services are being stopped simultaniously from ServiceManager.stoppingTestRun() and from ServiceManager.finishedTesting(), one of the threads sets "harness" variable to null, then another tries to remove observers.

stopServices() method should be synchronized - that will prevent from data inconsistency for Harness observers.
harness object checked for null inside stopServices() method in case second thread read ServiceManager as Harness observer during the first didn't removed it from observer list yet.

Changesets:
https://jtharness.dev.java.net/source/browse/jtharness?rev=1398&view=rev
https://jtharness.dev.java.net/source/browse/jtharness?rev=1399&view=rev

Thanks,
Sergey

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bkurotsu
Offline
Joined: 2004-12-13
Points: 0

Looks fine. Talked to Sergey - it was tested. Please integrate to trunk.

sergey_borodin
Offline
Joined: 2006-10-20
Points: 0

Integrated.

--Sergey