diff options
author | John Ross | 2013-11-22 16:50:08 +0000 |
---|---|---|
committer | John Ross | 2013-11-22 18:10:30 +0000 |
commit | d4275eb585156ed02f52d186a0cfb9eb8fa86819 (patch) | |
tree | 307136fa30eba7d79a80a65e254c23739f6014a1 /bundles/org.eclipse.equinox.coordinator | |
parent | 5bdaa4451d78c0dab69157169c53ee3ab40996c7 (diff) | |
download | rt.equinox.bundles-d4275eb585156ed02f52d186a0cfb9eb8fa86819.tar.gz rt.equinox.bundles-d4275eb585156ed02f52d186a0cfb9eb8fa86819.tar.xz rt.equinox.bundles-d4275eb585156ed02f52d186a0cfb9eb8fa86819.zip |
Bug 421487 - Check for null (again) when unwinding the thread local coordination stack.I20131126-0800
The previous fix still had a small window of opportunity for an NPE to occur. Each call to peek results in orphaned
coordination processing, so despite the initial check for coordinator.peek() != null, the subsequent calls to peek() could
result in null if a coordination on the thread local stack became orphaned during that time.
Diffstat (limited to 'bundles/org.eclipse.equinox.coordinator')
-rw-r--r-- | bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java b/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java index 1a241b9ef..2ad246c99 100644 --- a/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java +++ b/bundles/org.eclipse.equinox.coordinator/src/org/eclipse/equinox/coordinator/CoordinationImpl.java @@ -138,11 +138,14 @@ public class CoordinationImpl { } // Unwind the stack in case there are other coordinations higher // up than this one. See bug 421487 for why peek() may be null. - while (!(coordinator.peek() == null || coordinator.peek().equals(referent))) { + for (Coordination peeked = coordinator.peek(); !(peeked == null || referent.equals(peeked)); peeked = coordinator.peek()) { try { - coordinator.peek().end(); - } catch (CoordinationException e) { - coordinator.peek().fail(e); + peeked.end(); + } + catch (CoordinationException e) { + peeked = coordinator.peek(); + if (peeked != null) + peeked.fail(e); } } // A coordination is removed from the thread local stack only when being ended. |