Fixed an issue, where calling getEntity on BuiltResponsePreservingError would throw a previously caught error. We now throw an IllegalStateException to make it clear where the exception is coming from
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/71cfdc66 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/71cfdc66 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/71cfdc66 Branch: refs/heads/master Commit: 71cfdc66f5d4b75fdd68bb455c0f31e0a15dd9e5 Parents: 2864486 Author: Graeme-Miller <graeme.mil...@cloudsoftcorp.com> Authored: Wed Jan 13 15:35:17 2016 +0000 Committer: Graeme-Miller <graeme.mil...@cloudsoftcorp.com> Committed: Wed Jan 13 15:35:17 2016 +0000 ---------------------------------------------------------------------- .../rest/client/util/http/BuiltResponsePreservingError.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/71cfdc66/brooklyn-server/rest/rest-client/src/main/java/org/apache/brooklyn/rest/client/util/http/BuiltResponsePreservingError.java ---------------------------------------------------------------------- diff --git a/brooklyn-server/rest/rest-client/src/main/java/org/apache/brooklyn/rest/client/util/http/BuiltResponsePreservingError.java b/brooklyn-server/rest/rest-client/src/main/java/org/apache/brooklyn/rest/client/util/http/BuiltResponsePreservingError.java index fb43c4c..d011172 100644 --- a/brooklyn-server/rest/rest-client/src/main/java/org/apache/brooklyn/rest/client/util/http/BuiltResponsePreservingError.java +++ b/brooklyn-server/rest/rest-client/src/main/java/org/apache/brooklyn/rest/client/util/http/BuiltResponsePreservingError.java @@ -70,7 +70,9 @@ public class BuiltResponsePreservingError extends BuiltResponse { @Override public Object getEntity() { - if (error!=null) Exceptions.propagate(error); + if (error!=null) { + throw new IllegalStateException("getEntity called on BuiltResponsePreservingError, where an Error had been preserved", error); + } return super.getEntity(); }