brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [09/18] brooklyn-server git commit: logging for assertion failures
Date Fri, 04 Mar 2016 16:15:54 GMT
logging for assertion failures


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/a9376d1c
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/a9376d1c
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/a9376d1c

Branch: refs/heads/master
Commit: a9376d1c8742bcd0819e271034d1d947667ee6d3
Parents: c20a725
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Wed Feb 24 14:17:43 2016 -0800
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Wed Feb 24 15:09:13 2016 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/brooklyn/test/Asserts.java | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a9376d1c/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
index 3ad5bda..d0b4e13 100644
--- a/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
+++ b/utils/common/src/main/java/org/apache/brooklyn/test/Asserts.java
@@ -955,12 +955,13 @@ public class Asserts {
             log.info("succeedsEventually exceeded max attempts or timeout - {} attempts lasting
{} ms, for {}", new Object[] {attempt, System.currentTimeMillis()-startTime, c});
             if (lastException != null)
                 throw lastException;
-            throw fail("invalid result: "+result);
+            throw fail("invalid results; last was: "+result);
         } catch (Throwable t) {
             if (logException) log.info("failed succeeds-eventually, "+attempt+" attempts,
"+
                     (System.currentTimeMillis()-startTime)+"ms elapsed "+
                     "(rethrowing): "+t);
-            throw propagate(t);
+            throw Exceptions.propagateAnnotated("failed succeeds-eventually, "+attempt+"
attempts, "+
+                (System.currentTimeMillis()-startTime)+"ms elapsed", t);
         }
     }
 
@@ -1293,12 +1294,7 @@ public class Asserts {
     }
     
     private static RuntimeException propagate(Throwable t) {
-        if (t instanceof InterruptedException) {
-            Thread.currentThread().interrupt();
-        }
-        if (t instanceof RuntimeException) throw (RuntimeException)t;
-        if (t instanceof Error) throw (Error)t;
-        throw new RuntimeException(t);
+        throw Exceptions.propagate(t);
     }
 
     /** As {@link #eventuallyOnNotify(Object, Supplier, Predicate, Duration, boolean)} with
default timeout. */


Mime
View raw message