Introducing the idea of a stack of ExternalContexts.

This means that when we throw an ProvisionException, we can include the entire stack, rather than catching and adding context as necessary.

It also means it's slightly easier to push a new ExternalContext onto the stack.

git-svn-id: https://google-guice.googlecode.com/svn/trunk@348 d779f126-a31b-0410-b53b-1d3aecad763e
diff --git a/src/com/google/inject/BoundProviderFactory.java b/src/com/google/inject/BoundProviderFactory.java
index 61046a1..058a1f8 100644
--- a/src/com/google/inject/BoundProviderFactory.java
+++ b/src/com/google/inject/BoundProviderFactory.java
@@ -60,12 +60,11 @@
     Provider<? extends T> provider = providerFactory.get(context);
     try {
       return context.sanitize(provider.get(), source);
-    } catch(ProvisionException provisionException) {
-      provisionException.addContext(context.getExternalContext());
-      throw provisionException;
+    } catch(ProvisionException e) {
+      throw e;
     } catch(RuntimeException e) {
-      throw new ProvisionException(context.getExternalContext(), e,
-          ErrorMessages.ERROR_IN_PROVIDER);
+      throw new ProvisionException(context.getExternalContextStack(),
+          e, ErrorMessages.ERROR_IN_PROVIDER);
     }
   }
 }