Bug #11082
NPE in TemporaryAccountPool.shutDown() Method
Status:
New
Priority:
Low
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:
0%
billable:
No
vendor_id:
GCD
case_num:
version_reported:
16328
version_resolved:
History
#1 Updated by Vladimir Tsichevski 7 months ago
The TemporaryAccountPool.shutDown() method is defined as follows:
public static void shutDown() {
synchronized (taskLock) {
poolTask.terminate();
// wait for thread to die
try {
worker.join(5000);
} catch (InterruptedException e) {
LOG.logp(Level.WARNING,
"TemporaryAccountPool",
"shutDown",
"InterruptedException!",
e);
}
}
}
Both poolTask and worker are nullable fields, initialized only during the call to TemporaryAccountPool.getInstance().
If an exception occurs during initialization (assumed to be logged or re-thrown as ConfigurationException), these fields may remain null.
The call to shutDown() throws a NullPointerException when accessing poolTask or worker,
which complicates debugging and hides the original initialization failure.
Proposed Fix
Add null checks for both fields before use. This prevents unnecessary NPEs during shutdown and allows the original configuration error to remain the primary issue for investigation.