+
+ /**
+ * Return whether this throwable was caused by an OutOfMemoryError
+ * condition. An exception is deemed to be caused by OutOfMemoryError
+ * if the throwable or any of its causes is of the type OutOfMemoryError.
+ * <p>
+ * This method is required because Apple's JRE implementation sometimes
+ * masks OutOfMemoryErrors within RuntimeExceptions. Idiots.
+ *
+ * @param t the throwable to examine.
+ * @return whether this is an out-of-memory condition.
+ */
+ private boolean isOutOfMemoryError(Throwable t) {
+ while (t != null) {
+ if (t instanceof OutOfMemoryError)
+ return true;
+ t = t.getCause();
+ }
+ return false;
+ }
+
+
+