1.1 --- a/emul/src/main/java/java/lang/Throwable.java Wed Dec 05 10:03:58 2012 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,1080 +0,0 @@
1.4 -/*
1.5 - * Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
1.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1.7 - *
1.8 - * This code is free software; you can redistribute it and/or modify it
1.9 - * under the terms of the GNU General Public License version 2 only, as
1.10 - * published by the Free Software Foundation. Oracle designates this
1.11 - * particular file as subject to the "Classpath" exception as provided
1.12 - * by Oracle in the LICENSE file that accompanied this code.
1.13 - *
1.14 - * This code is distributed in the hope that it will be useful, but WITHOUT
1.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1.17 - * version 2 for more details (a copy is included in the LICENSE file that
1.18 - * accompanied this code).
1.19 - *
1.20 - * You should have received a copy of the GNU General Public License version
1.21 - * 2 along with this work; if not, write to the Free Software Foundation,
1.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1.23 - *
1.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1.25 - * or visit www.oracle.com if you need additional information or have any
1.26 - * questions.
1.27 - */
1.28 -
1.29 -package java.lang;
1.30 -import java.io.*;
1.31 -import org.apidesign.bck2brwsr.core.JavaScriptBody;
1.32 -
1.33 -/**
1.34 - * The {@code Throwable} class is the superclass of all errors and
1.35 - * exceptions in the Java language. Only objects that are instances of this
1.36 - * class (or one of its subclasses) are thrown by the Java Virtual Machine or
1.37 - * can be thrown by the Java {@code throw} statement. Similarly, only
1.38 - * this class or one of its subclasses can be the argument type in a
1.39 - * {@code catch} clause.
1.40 - *
1.41 - * For the purposes of compile-time checking of exceptions, {@code
1.42 - * Throwable} and any subclass of {@code Throwable} that is not also a
1.43 - * subclass of either {@link RuntimeException} or {@link Error} are
1.44 - * regarded as checked exceptions.
1.45 - *
1.46 - * <p>Instances of two subclasses, {@link java.lang.Error} and
1.47 - * {@link java.lang.Exception}, are conventionally used to indicate
1.48 - * that exceptional situations have occurred. Typically, these instances
1.49 - * are freshly created in the context of the exceptional situation so
1.50 - * as to include relevant information (such as stack trace data).
1.51 - *
1.52 - * <p>A throwable contains a snapshot of the execution stack of its
1.53 - * thread at the time it was created. It can also contain a message
1.54 - * string that gives more information about the error. Over time, a
1.55 - * throwable can {@linkplain Throwable#addSuppressed suppress} other
1.56 - * throwables from being propagated. Finally, the throwable can also
1.57 - * contain a <i>cause</i>: another throwable that caused this
1.58 - * throwable to be constructed. The recording of this causal information
1.59 - * is referred to as the <i>chained exception</i> facility, as the
1.60 - * cause can, itself, have a cause, and so on, leading to a "chain" of
1.61 - * exceptions, each caused by another.
1.62 - *
1.63 - * <p>One reason that a throwable may have a cause is that the class that
1.64 - * throws it is built atop a lower layered abstraction, and an operation on
1.65 - * the upper layer fails due to a failure in the lower layer. It would be bad
1.66 - * design to let the throwable thrown by the lower layer propagate outward, as
1.67 - * it is generally unrelated to the abstraction provided by the upper layer.
1.68 - * Further, doing so would tie the API of the upper layer to the details of
1.69 - * its implementation, assuming the lower layer's exception was a checked
1.70 - * exception. Throwing a "wrapped exception" (i.e., an exception containing a
1.71 - * cause) allows the upper layer to communicate the details of the failure to
1.72 - * its caller without incurring either of these shortcomings. It preserves
1.73 - * the flexibility to change the implementation of the upper layer without
1.74 - * changing its API (in particular, the set of exceptions thrown by its
1.75 - * methods).
1.76 - *
1.77 - * <p>A second reason that a throwable may have a cause is that the method
1.78 - * that throws it must conform to a general-purpose interface that does not
1.79 - * permit the method to throw the cause directly. For example, suppose
1.80 - * a persistent collection conforms to the {@link java.util.Collection
1.81 - * Collection} interface, and that its persistence is implemented atop
1.82 - * {@code java.io}. Suppose the internals of the {@code add} method
1.83 - * can throw an {@link java.io.IOException IOException}. The implementation
1.84 - * can communicate the details of the {@code IOException} to its caller
1.85 - * while conforming to the {@code Collection} interface by wrapping the
1.86 - * {@code IOException} in an appropriate unchecked exception. (The
1.87 - * specification for the persistent collection should indicate that it is
1.88 - * capable of throwing such exceptions.)
1.89 - *
1.90 - * <p>A cause can be associated with a throwable in two ways: via a
1.91 - * constructor that takes the cause as an argument, or via the
1.92 - * {@link #initCause(Throwable)} method. New throwable classes that
1.93 - * wish to allow causes to be associated with them should provide constructors
1.94 - * that take a cause and delegate (perhaps indirectly) to one of the
1.95 - * {@code Throwable} constructors that takes a cause.
1.96 - *
1.97 - * Because the {@code initCause} method is public, it allows a cause to be
1.98 - * associated with any throwable, even a "legacy throwable" whose
1.99 - * implementation predates the addition of the exception chaining mechanism to
1.100 - * {@code Throwable}.
1.101 - *
1.102 - * <p>By convention, class {@code Throwable} and its subclasses have two
1.103 - * constructors, one that takes no arguments and one that takes a
1.104 - * {@code String} argument that can be used to produce a detail message.
1.105 - * Further, those subclasses that might likely have a cause associated with
1.106 - * them should have two more constructors, one that takes a
1.107 - * {@code Throwable} (the cause), and one that takes a
1.108 - * {@code String} (the detail message) and a {@code Throwable} (the
1.109 - * cause).
1.110 - *
1.111 - * @author unascribed
1.112 - * @author Josh Bloch (Added exception chaining and programmatic access to
1.113 - * stack trace in 1.4.)
1.114 - * @jls 11.2 Compile-Time Checking of Exceptions
1.115 - * @since JDK1.0
1.116 - */
1.117 -public class Throwable implements Serializable {
1.118 - /** use serialVersionUID from JDK 1.0.2 for interoperability */
1.119 - private static final long serialVersionUID = -3042686055658047285L;
1.120 -
1.121 - /**
1.122 - * Native code saves some indication of the stack backtrace in this slot.
1.123 - */
1.124 - private transient Object backtrace;
1.125 -
1.126 - /**
1.127 - * Specific details about the Throwable. For example, for
1.128 - * {@code FileNotFoundException}, this contains the name of
1.129 - * the file that could not be found.
1.130 - *
1.131 - * @serial
1.132 - */
1.133 - private String detailMessage;
1.134 -
1.135 -
1.136 - /**
1.137 - * Holder class to defer initializing sentinel objects only used
1.138 - * for serialization.
1.139 - */
1.140 - private static class SentinelHolder {
1.141 - /**
1.142 - * {@linkplain #setStackTrace(StackTraceElement[]) Setting the
1.143 - * stack trace} to a one-element array containing this sentinel
1.144 - * value indicates future attempts to set the stack trace will be
1.145 - * ignored. The sentinal is equal to the result of calling:<br>
1.146 - * {@code new StackTraceElement("", "", null, Integer.MIN_VALUE)}
1.147 - */
1.148 - public static final StackTraceElement STACK_TRACE_ELEMENT_SENTINEL =
1.149 - new StackTraceElement("", "", null, Integer.MIN_VALUE);
1.150 -
1.151 - /**
1.152 - * Sentinel value used in the serial form to indicate an immutable
1.153 - * stack trace.
1.154 - */
1.155 - public static final StackTraceElement[] STACK_TRACE_SENTINEL =
1.156 - new StackTraceElement[] {STACK_TRACE_ELEMENT_SENTINEL};
1.157 - }
1.158 -
1.159 - /**
1.160 - * A shared value for an empty stack.
1.161 - */
1.162 - private static final StackTraceElement[] UNASSIGNED_STACK = new StackTraceElement[0];
1.163 -
1.164 - /*
1.165 - * To allow Throwable objects to be made immutable and safely
1.166 - * reused by the JVM, such as OutOfMemoryErrors, fields of
1.167 - * Throwable that are writable in response to user actions, cause,
1.168 - * stackTrace, and suppressedExceptions obey the following
1.169 - * protocol:
1.170 - *
1.171 - * 1) The fields are initialized to a non-null sentinel value
1.172 - * which indicates the value has logically not been set.
1.173 - *
1.174 - * 2) Writing a null to the field indicates further writes
1.175 - * are forbidden
1.176 - *
1.177 - * 3) The sentinel value may be replaced with another non-null
1.178 - * value.
1.179 - *
1.180 - * For example, implementations of the HotSpot JVM have
1.181 - * preallocated OutOfMemoryError objects to provide for better
1.182 - * diagnosability of that situation. These objects are created
1.183 - * without calling the constructor for that class and the fields
1.184 - * in question are initialized to null. To support this
1.185 - * capability, any new fields added to Throwable that require
1.186 - * being initialized to a non-null value require a coordinated JVM
1.187 - * change.
1.188 - */
1.189 -
1.190 - /**
1.191 - * The throwable that caused this throwable to get thrown, or null if this
1.192 - * throwable was not caused by another throwable, or if the causative
1.193 - * throwable is unknown. If this field is equal to this throwable itself,
1.194 - * it indicates that the cause of this throwable has not yet been
1.195 - * initialized.
1.196 - *
1.197 - * @serial
1.198 - * @since 1.4
1.199 - */
1.200 - private Throwable cause = this;
1.201 -
1.202 - /**
1.203 - * The stack trace, as returned by {@link #getStackTrace()}.
1.204 - *
1.205 - * The field is initialized to a zero-length array. A {@code
1.206 - * null} value of this field indicates subsequent calls to {@link
1.207 - * #setStackTrace(StackTraceElement[])} and {@link
1.208 - * #fillInStackTrace()} will be be no-ops.
1.209 - *
1.210 - * @serial
1.211 - * @since 1.4
1.212 - */
1.213 - private StackTraceElement[] stackTrace = UNASSIGNED_STACK;
1.214 -
1.215 - // Setting this static field introduces an acceptable
1.216 - // initialization dependency on a few java.util classes.
1.217 -// I don't think this dependency is acceptable
1.218 -// private static final List<Throwable> SUPPRESSED_SENTINEL =
1.219 -// Collections.unmodifiableList(new ArrayList<Throwable>(0));
1.220 -
1.221 - /**
1.222 - * The list of suppressed exceptions, as returned by {@link
1.223 - * #getSuppressed()}. The list is initialized to a zero-element
1.224 - * unmodifiable sentinel list. When a serialized Throwable is
1.225 - * read in, if the {@code suppressedExceptions} field points to a
1.226 - * zero-element list, the field is reset to the sentinel value.
1.227 - *
1.228 - * @serial
1.229 - * @since 1.7
1.230 - */
1.231 -// private List<Throwable> suppressedExceptions = SUPPRESSED_SENTINEL;
1.232 -
1.233 - /** Message for trying to suppress a null exception. */
1.234 - private static final String NULL_CAUSE_MESSAGE = "Cannot suppress a null exception.";
1.235 -
1.236 - /** Message for trying to suppress oneself. */
1.237 - private static final String SELF_SUPPRESSION_MESSAGE = "Self-suppression not permitted";
1.238 -
1.239 - /** Caption for labeling causative exception stack traces */
1.240 - private static final String CAUSE_CAPTION = "Caused by: ";
1.241 -
1.242 - /** Caption for labeling suppressed exception stack traces */
1.243 - private static final String SUPPRESSED_CAPTION = "Suppressed: ";
1.244 -
1.245 - /**
1.246 - * Constructs a new throwable with {@code null} as its detail message.
1.247 - * The cause is not initialized, and may subsequently be initialized by a
1.248 - * call to {@link #initCause}.
1.249 - *
1.250 - * <p>The {@link #fillInStackTrace()} method is called to initialize
1.251 - * the stack trace data in the newly created throwable.
1.252 - */
1.253 - public Throwable() {
1.254 - fillInStackTrace();
1.255 - }
1.256 -
1.257 - /**
1.258 - * Constructs a new throwable with the specified detail message. The
1.259 - * cause is not initialized, and may subsequently be initialized by
1.260 - * a call to {@link #initCause}.
1.261 - *
1.262 - * <p>The {@link #fillInStackTrace()} method is called to initialize
1.263 - * the stack trace data in the newly created throwable.
1.264 - *
1.265 - * @param message the detail message. The detail message is saved for
1.266 - * later retrieval by the {@link #getMessage()} method.
1.267 - */
1.268 - public Throwable(String message) {
1.269 - fillInStackTrace();
1.270 - detailMessage = message;
1.271 - }
1.272 -
1.273 - /**
1.274 - * Constructs a new throwable with the specified detail message and
1.275 - * cause. <p>Note that the detail message associated with
1.276 - * {@code cause} is <i>not</i> automatically incorporated in
1.277 - * this throwable's detail message.
1.278 - *
1.279 - * <p>The {@link #fillInStackTrace()} method is called to initialize
1.280 - * the stack trace data in the newly created throwable.
1.281 - *
1.282 - * @param message the detail message (which is saved for later retrieval
1.283 - * by the {@link #getMessage()} method).
1.284 - * @param cause the cause (which is saved for later retrieval by the
1.285 - * {@link #getCause()} method). (A {@code null} value is
1.286 - * permitted, and indicates that the cause is nonexistent or
1.287 - * unknown.)
1.288 - * @since 1.4
1.289 - */
1.290 - public Throwable(String message, Throwable cause) {
1.291 - fillInStackTrace();
1.292 - detailMessage = message;
1.293 - this.cause = cause;
1.294 - }
1.295 -
1.296 - /**
1.297 - * Constructs a new throwable with the specified cause and a detail
1.298 - * message of {@code (cause==null ? null : cause.toString())} (which
1.299 - * typically contains the class and detail message of {@code cause}).
1.300 - * This constructor is useful for throwables that are little more than
1.301 - * wrappers for other throwables (for example, {@link
1.302 - * java.security.PrivilegedActionException}).
1.303 - *
1.304 - * <p>The {@link #fillInStackTrace()} method is called to initialize
1.305 - * the stack trace data in the newly created throwable.
1.306 - *
1.307 - * @param cause the cause (which is saved for later retrieval by the
1.308 - * {@link #getCause()} method). (A {@code null} value is
1.309 - * permitted, and indicates that the cause is nonexistent or
1.310 - * unknown.)
1.311 - * @since 1.4
1.312 - */
1.313 - public Throwable(Throwable cause) {
1.314 - fillInStackTrace();
1.315 - detailMessage = (cause==null ? null : cause.toString());
1.316 - this.cause = cause;
1.317 - }
1.318 -
1.319 - /**
1.320 - * Constructs a new throwable with the specified detail message,
1.321 - * cause, {@linkplain #addSuppressed suppression} enabled or
1.322 - * disabled, and writable stack trace enabled or disabled. If
1.323 - * suppression is disabled, {@link #getSuppressed} for this object
1.324 - * will return a zero-length array and calls to {@link
1.325 - * #addSuppressed} that would otherwise append an exception to the
1.326 - * suppressed list will have no effect. If the writable stack
1.327 - * trace is false, this constructor will not call {@link
1.328 - * #fillInStackTrace()}, a {@code null} will be written to the
1.329 - * {@code stackTrace} field, and subsequent calls to {@code
1.330 - * fillInStackTrace} and {@link
1.331 - * #setStackTrace(StackTraceElement[])} will not set the stack
1.332 - * trace. If the writable stack trace is false, {@link
1.333 - * #getStackTrace} will return a zero length array.
1.334 - *
1.335 - * <p>Note that the other constructors of {@code Throwable} treat
1.336 - * suppression as being enabled and the stack trace as being
1.337 - * writable. Subclasses of {@code Throwable} should document any
1.338 - * conditions under which suppression is disabled and document
1.339 - * conditions under which the stack trace is not writable.
1.340 - * Disabling of suppression should only occur in exceptional
1.341 - * circumstances where special requirements exist, such as a
1.342 - * virtual machine reusing exception objects under low-memory
1.343 - * situations. Circumstances where a given exception object is
1.344 - * repeatedly caught and rethrown, such as to implement control
1.345 - * flow between two sub-systems, is another situation where
1.346 - * immutable throwable objects would be appropriate.
1.347 - *
1.348 - * @param message the detail message.
1.349 - * @param cause the cause. (A {@code null} value is permitted,
1.350 - * and indicates that the cause is nonexistent or unknown.)
1.351 - * @param enableSuppression whether or not suppression is enabled or disabled
1.352 - * @param writableStackTrace whether or not the stack trace should be
1.353 - * writable
1.354 - *
1.355 - * @see OutOfMemoryError
1.356 - * @see NullPointerException
1.357 - * @see ArithmeticException
1.358 - * @since 1.7
1.359 - */
1.360 - protected Throwable(String message, Throwable cause,
1.361 - boolean enableSuppression,
1.362 - boolean writableStackTrace) {
1.363 - if (writableStackTrace) {
1.364 - fillInStackTrace();
1.365 - } else {
1.366 - stackTrace = null;
1.367 - }
1.368 - detailMessage = message;
1.369 - this.cause = cause;
1.370 -// if (!enableSuppression)
1.371 -// suppressedExceptions = null;
1.372 - }
1.373 -
1.374 - /**
1.375 - * Returns the detail message string of this throwable.
1.376 - *
1.377 - * @return the detail message string of this {@code Throwable} instance
1.378 - * (which may be {@code null}).
1.379 - */
1.380 - public String getMessage() {
1.381 - return detailMessage;
1.382 - }
1.383 -
1.384 - /**
1.385 - * Creates a localized description of this throwable.
1.386 - * Subclasses may override this method in order to produce a
1.387 - * locale-specific message. For subclasses that do not override this
1.388 - * method, the default implementation returns the same result as
1.389 - * {@code getMessage()}.
1.390 - *
1.391 - * @return The localized description of this throwable.
1.392 - * @since JDK1.1
1.393 - */
1.394 - public String getLocalizedMessage() {
1.395 - return getMessage();
1.396 - }
1.397 -
1.398 - /**
1.399 - * Returns the cause of this throwable or {@code null} if the
1.400 - * cause is nonexistent or unknown. (The cause is the throwable that
1.401 - * caused this throwable to get thrown.)
1.402 - *
1.403 - * <p>This implementation returns the cause that was supplied via one of
1.404 - * the constructors requiring a {@code Throwable}, or that was set after
1.405 - * creation with the {@link #initCause(Throwable)} method. While it is
1.406 - * typically unnecessary to override this method, a subclass can override
1.407 - * it to return a cause set by some other means. This is appropriate for
1.408 - * a "legacy chained throwable" that predates the addition of chained
1.409 - * exceptions to {@code Throwable}. Note that it is <i>not</i>
1.410 - * necessary to override any of the {@code PrintStackTrace} methods,
1.411 - * all of which invoke the {@code getCause} method to determine the
1.412 - * cause of a throwable.
1.413 - *
1.414 - * @return the cause of this throwable or {@code null} if the
1.415 - * cause is nonexistent or unknown.
1.416 - * @since 1.4
1.417 - */
1.418 - public synchronized Throwable getCause() {
1.419 - return (cause==this ? null : cause);
1.420 - }
1.421 -
1.422 - /**
1.423 - * Initializes the <i>cause</i> of this throwable to the specified value.
1.424 - * (The cause is the throwable that caused this throwable to get thrown.)
1.425 - *
1.426 - * <p>This method can be called at most once. It is generally called from
1.427 - * within the constructor, or immediately after creating the
1.428 - * throwable. If this throwable was created
1.429 - * with {@link #Throwable(Throwable)} or
1.430 - * {@link #Throwable(String,Throwable)}, this method cannot be called
1.431 - * even once.
1.432 - *
1.433 - * <p>An example of using this method on a legacy throwable type
1.434 - * without other support for setting the cause is:
1.435 - *
1.436 - * <pre>
1.437 - * try {
1.438 - * lowLevelOp();
1.439 - * } catch (LowLevelException le) {
1.440 - * throw (HighLevelException)
1.441 - * new HighLevelException().initCause(le); // Legacy constructor
1.442 - * }
1.443 - * </pre>
1.444 - *
1.445 - * @param cause the cause (which is saved for later retrieval by the
1.446 - * {@link #getCause()} method). (A {@code null} value is
1.447 - * permitted, and indicates that the cause is nonexistent or
1.448 - * unknown.)
1.449 - * @return a reference to this {@code Throwable} instance.
1.450 - * @throws IllegalArgumentException if {@code cause} is this
1.451 - * throwable. (A throwable cannot be its own cause.)
1.452 - * @throws IllegalStateException if this throwable was
1.453 - * created with {@link #Throwable(Throwable)} or
1.454 - * {@link #Throwable(String,Throwable)}, or this method has already
1.455 - * been called on this throwable.
1.456 - * @since 1.4
1.457 - */
1.458 - public synchronized Throwable initCause(Throwable cause) {
1.459 - if (this.cause != this)
1.460 - throw new IllegalStateException("Can't overwrite cause");
1.461 - if (cause == this)
1.462 - throw new IllegalArgumentException("Self-causation not permitted");
1.463 - this.cause = cause;
1.464 - return this;
1.465 - }
1.466 -
1.467 - /**
1.468 - * Returns a short description of this throwable.
1.469 - * The result is the concatenation of:
1.470 - * <ul>
1.471 - * <li> the {@linkplain Class#getName() name} of the class of this object
1.472 - * <li> ": " (a colon and a space)
1.473 - * <li> the result of invoking this object's {@link #getLocalizedMessage}
1.474 - * method
1.475 - * </ul>
1.476 - * If {@code getLocalizedMessage} returns {@code null}, then just
1.477 - * the class name is returned.
1.478 - *
1.479 - * @return a string representation of this throwable.
1.480 - */
1.481 - public String toString() {
1.482 - String s = getClass().getName();
1.483 - String message = getLocalizedMessage();
1.484 - return (message != null) ? (s + ": " + message) : s;
1.485 - }
1.486 -
1.487 - /**
1.488 - * Prints this throwable and its backtrace to the
1.489 - * standard error stream. This method prints a stack trace for this
1.490 - * {@code Throwable} object on the error output stream that is
1.491 - * the value of the field {@code System.err}. The first line of
1.492 - * output contains the result of the {@link #toString()} method for
1.493 - * this object. Remaining lines represent data previously recorded by
1.494 - * the method {@link #fillInStackTrace()}. The format of this
1.495 - * information depends on the implementation, but the following
1.496 - * example may be regarded as typical:
1.497 - * <blockquote><pre>
1.498 - * java.lang.NullPointerException
1.499 - * at MyClass.mash(MyClass.java:9)
1.500 - * at MyClass.crunch(MyClass.java:6)
1.501 - * at MyClass.main(MyClass.java:3)
1.502 - * </pre></blockquote>
1.503 - * This example was produced by running the program:
1.504 - * <pre>
1.505 - * class MyClass {
1.506 - * public static void main(String[] args) {
1.507 - * crunch(null);
1.508 - * }
1.509 - * static void crunch(int[] a) {
1.510 - * mash(a);
1.511 - * }
1.512 - * static void mash(int[] b) {
1.513 - * System.out.println(b[0]);
1.514 - * }
1.515 - * }
1.516 - * </pre>
1.517 - * The backtrace for a throwable with an initialized, non-null cause
1.518 - * should generally include the backtrace for the cause. The format
1.519 - * of this information depends on the implementation, but the following
1.520 - * example may be regarded as typical:
1.521 - * <pre>
1.522 - * HighLevelException: MidLevelException: LowLevelException
1.523 - * at Junk.a(Junk.java:13)
1.524 - * at Junk.main(Junk.java:4)
1.525 - * Caused by: MidLevelException: LowLevelException
1.526 - * at Junk.c(Junk.java:23)
1.527 - * at Junk.b(Junk.java:17)
1.528 - * at Junk.a(Junk.java:11)
1.529 - * ... 1 more
1.530 - * Caused by: LowLevelException
1.531 - * at Junk.e(Junk.java:30)
1.532 - * at Junk.d(Junk.java:27)
1.533 - * at Junk.c(Junk.java:21)
1.534 - * ... 3 more
1.535 - * </pre>
1.536 - * Note the presence of lines containing the characters {@code "..."}.
1.537 - * These lines indicate that the remainder of the stack trace for this
1.538 - * exception matches the indicated number of frames from the bottom of the
1.539 - * stack trace of the exception that was caused by this exception (the
1.540 - * "enclosing" exception). This shorthand can greatly reduce the length
1.541 - * of the output in the common case where a wrapped exception is thrown
1.542 - * from same method as the "causative exception" is caught. The above
1.543 - * example was produced by running the program:
1.544 - * <pre>
1.545 - * public class Junk {
1.546 - * public static void main(String args[]) {
1.547 - * try {
1.548 - * a();
1.549 - * } catch(HighLevelException e) {
1.550 - * e.printStackTrace();
1.551 - * }
1.552 - * }
1.553 - * static void a() throws HighLevelException {
1.554 - * try {
1.555 - * b();
1.556 - * } catch(MidLevelException e) {
1.557 - * throw new HighLevelException(e);
1.558 - * }
1.559 - * }
1.560 - * static void b() throws MidLevelException {
1.561 - * c();
1.562 - * }
1.563 - * static void c() throws MidLevelException {
1.564 - * try {
1.565 - * d();
1.566 - * } catch(LowLevelException e) {
1.567 - * throw new MidLevelException(e);
1.568 - * }
1.569 - * }
1.570 - * static void d() throws LowLevelException {
1.571 - * e();
1.572 - * }
1.573 - * static void e() throws LowLevelException {
1.574 - * throw new LowLevelException();
1.575 - * }
1.576 - * }
1.577 - *
1.578 - * class HighLevelException extends Exception {
1.579 - * HighLevelException(Throwable cause) { super(cause); }
1.580 - * }
1.581 - *
1.582 - * class MidLevelException extends Exception {
1.583 - * MidLevelException(Throwable cause) { super(cause); }
1.584 - * }
1.585 - *
1.586 - * class LowLevelException extends Exception {
1.587 - * }
1.588 - * </pre>
1.589 - * As of release 7, the platform supports the notion of
1.590 - * <i>suppressed exceptions</i> (in conjunction with the {@code
1.591 - * try}-with-resources statement). Any exceptions that were
1.592 - * suppressed in order to deliver an exception are printed out
1.593 - * beneath the stack trace. The format of this information
1.594 - * depends on the implementation, but the following example may be
1.595 - * regarded as typical:
1.596 - *
1.597 - * <pre>
1.598 - * Exception in thread "main" java.lang.Exception: Something happened
1.599 - * at Foo.bar(Foo.java:10)
1.600 - * at Foo.main(Foo.java:5)
1.601 - * Suppressed: Resource$CloseFailException: Resource ID = 0
1.602 - * at Resource.close(Resource.java:26)
1.603 - * at Foo.bar(Foo.java:9)
1.604 - * ... 1 more
1.605 - * </pre>
1.606 - * Note that the "... n more" notation is used on suppressed exceptions
1.607 - * just at it is used on causes. Unlike causes, suppressed exceptions are
1.608 - * indented beyond their "containing exceptions."
1.609 - *
1.610 - * <p>An exception can have both a cause and one or more suppressed
1.611 - * exceptions:
1.612 - * <pre>
1.613 - * Exception in thread "main" java.lang.Exception: Main block
1.614 - * at Foo3.main(Foo3.java:7)
1.615 - * Suppressed: Resource$CloseFailException: Resource ID = 2
1.616 - * at Resource.close(Resource.java:26)
1.617 - * at Foo3.main(Foo3.java:5)
1.618 - * Suppressed: Resource$CloseFailException: Resource ID = 1
1.619 - * at Resource.close(Resource.java:26)
1.620 - * at Foo3.main(Foo3.java:5)
1.621 - * Caused by: java.lang.Exception: I did it
1.622 - * at Foo3.main(Foo3.java:8)
1.623 - * </pre>
1.624 - * Likewise, a suppressed exception can have a cause:
1.625 - * <pre>
1.626 - * Exception in thread "main" java.lang.Exception: Main block
1.627 - * at Foo4.main(Foo4.java:6)
1.628 - * Suppressed: Resource2$CloseFailException: Resource ID = 1
1.629 - * at Resource2.close(Resource2.java:20)
1.630 - * at Foo4.main(Foo4.java:5)
1.631 - * Caused by: java.lang.Exception: Rats, you caught me
1.632 - * at Resource2$CloseFailException.<init>(Resource2.java:45)
1.633 - * ... 2 more
1.634 - * </pre>
1.635 - */
1.636 -// public void printStackTrace() {
1.637 -// printStackTrace(System.err);
1.638 -// }
1.639 -//
1.640 -// /**
1.641 -// * Prints this throwable and its backtrace to the specified print stream.
1.642 -// *
1.643 -// * @param s {@code PrintStream} to use for output
1.644 -// */
1.645 -// public void printStackTrace(PrintStream s) {
1.646 -// printStackTrace(new WrappedPrintStream(s));
1.647 -// }
1.648 -//
1.649 -// private void printStackTrace(PrintStreamOrWriter s) {
1.650 -// // Guard against malicious overrides of Throwable.equals by
1.651 -// // using a Set with identity equality semantics.
1.652 -//// Set<Throwable> dejaVu =
1.653 -//// Collections.newSetFromMap(new IdentityHashMap<Throwable, Boolean>());
1.654 -//// dejaVu.add(this);
1.655 -//
1.656 -// synchronized (s.lock()) {
1.657 -// // Print our stack trace
1.658 -// s.println(this);
1.659 -// StackTraceElement[] trace = getOurStackTrace();
1.660 -// for (StackTraceElement traceElement : trace)
1.661 -// s.println("\tat " + traceElement);
1.662 -//
1.663 -// // Print suppressed exceptions, if any
1.664 -//// for (Throwable se : getSuppressed())
1.665 -//// se.printEnclosedStackTrace(s, trace, SUPPRESSED_CAPTION, "\t", dejaVu);
1.666 -//
1.667 -// // Print cause, if any
1.668 -// Throwable ourCause = getCause();
1.669 -//// if (ourCause != null)
1.670 -//// ourCause.printEnclosedStackTrace(s, trace, CAUSE_CAPTION, "", dejaVu);
1.671 -// }
1.672 -// }
1.673 -//
1.674 -// /**
1.675 -// * Print our stack trace as an enclosed exception for the specified
1.676 -// * stack trace.
1.677 -// */
1.678 -// private void printEnclosedStackTrace(PrintStreamOrWriter s,
1.679 -// StackTraceElement[] enclosingTrace,
1.680 -// String caption,
1.681 -// String prefix,
1.682 -// Object dejaVu) {
1.683 -// assert Thread.holdsLock(s.lock());
1.684 -// {
1.685 -// // Compute number of frames in common between this and enclosing trace
1.686 -// StackTraceElement[] trace = getOurStackTrace();
1.687 -// int m = trace.length - 1;
1.688 -// int n = enclosingTrace.length - 1;
1.689 -// while (m >= 0 && n >=0 && trace[m].equals(enclosingTrace[n])) {
1.690 -// m--; n--;
1.691 -// }
1.692 -// int framesInCommon = trace.length - 1 - m;
1.693 -//
1.694 -// // Print our stack trace
1.695 -// s.println(prefix + caption + this);
1.696 -// for (int i = 0; i <= m; i++)
1.697 -// s.println(prefix + "\tat " + trace[i]);
1.698 -// if (framesInCommon != 0)
1.699 -// s.println(prefix + "\t... " + framesInCommon + " more");
1.700 -//
1.701 -// // Print suppressed exceptions, if any
1.702 -// for (Throwable se : getSuppressed())
1.703 -// se.printEnclosedStackTrace(s, trace, SUPPRESSED_CAPTION,
1.704 -// prefix +"\t", dejaVu);
1.705 -//
1.706 -// // Print cause, if any
1.707 -// Throwable ourCause = getCause();
1.708 -// if (ourCause != null)
1.709 -// ourCause.printEnclosedStackTrace(s, trace, CAUSE_CAPTION, prefix, dejaVu);
1.710 -// }
1.711 -// }
1.712 -//
1.713 -// /**
1.714 -// * Prints this throwable and its backtrace to the specified
1.715 -// * print writer.
1.716 -// *
1.717 -// * @param s {@code PrintWriter} to use for output
1.718 -// * @since JDK1.1
1.719 -// */
1.720 -// public void printStackTrace(PrintWriter s) {
1.721 -// printStackTrace(new WrappedPrintWriter(s));
1.722 -// }
1.723 -//
1.724 -// /**
1.725 -// * Wrapper class for PrintStream and PrintWriter to enable a single
1.726 -// * implementation of printStackTrace.
1.727 -// */
1.728 -// private abstract static class PrintStreamOrWriter {
1.729 -// /** Returns the object to be locked when using this StreamOrWriter */
1.730 -// abstract Object lock();
1.731 -//
1.732 -// /** Prints the specified string as a line on this StreamOrWriter */
1.733 -// abstract void println(Object o);
1.734 -// }
1.735 -//
1.736 -// private static class WrappedPrintStream extends PrintStreamOrWriter {
1.737 -// private final PrintStream printStream;
1.738 -//
1.739 -// WrappedPrintStream(PrintStream printStream) {
1.740 -// this.printStream = printStream;
1.741 -// }
1.742 -//
1.743 -// Object lock() {
1.744 -// return printStream;
1.745 -// }
1.746 -//
1.747 -// void println(Object o) {
1.748 -// printStream.println(o);
1.749 -// }
1.750 -// }
1.751 -//
1.752 -// private static class WrappedPrintWriter extends PrintStreamOrWriter {
1.753 -// private final PrintWriter printWriter;
1.754 -//
1.755 -// WrappedPrintWriter(PrintWriter printWriter) {
1.756 -// this.printWriter = printWriter;
1.757 -// }
1.758 -//
1.759 -// Object lock() {
1.760 -// return printWriter;
1.761 -// }
1.762 -//
1.763 -// void println(Object o) {
1.764 -// printWriter.println(o);
1.765 -// }
1.766 -// }
1.767 -
1.768 - /**
1.769 - * Fills in the execution stack trace. This method records within this
1.770 - * {@code Throwable} object information about the current state of
1.771 - * the stack frames for the current thread.
1.772 - *
1.773 - * <p>If the stack trace of this {@code Throwable} {@linkplain
1.774 - * Throwable#Throwable(String, Throwable, boolean, boolean) is not
1.775 - * writable}, calling this method has no effect.
1.776 - *
1.777 - * @return a reference to this {@code Throwable} instance.
1.778 - * @see java.lang.Throwable#printStackTrace()
1.779 - */
1.780 - public synchronized Throwable fillInStackTrace() {
1.781 - if (stackTrace != null ||
1.782 - backtrace != null /* Out of protocol state */ ) {
1.783 - fillInStackTrace(0);
1.784 - stackTrace = UNASSIGNED_STACK;
1.785 - }
1.786 - return this;
1.787 - }
1.788 -
1.789 - @JavaScriptBody(args = { "self", "dummy" }, body = "")
1.790 - private native Throwable fillInStackTrace(int dummy);
1.791 -
1.792 - /**
1.793 - * Provides programmatic access to the stack trace information printed by
1.794 - * {@link #printStackTrace()}. Returns an array of stack trace elements,
1.795 - * each representing one stack frame. The zeroth element of the array
1.796 - * (assuming the array's length is non-zero) represents the top of the
1.797 - * stack, which is the last method invocation in the sequence. Typically,
1.798 - * this is the point at which this throwable was created and thrown.
1.799 - * The last element of the array (assuming the array's length is non-zero)
1.800 - * represents the bottom of the stack, which is the first method invocation
1.801 - * in the sequence.
1.802 - *
1.803 - * <p>Some virtual machines may, under some circumstances, omit one
1.804 - * or more stack frames from the stack trace. In the extreme case,
1.805 - * a virtual machine that has no stack trace information concerning
1.806 - * this throwable is permitted to return a zero-length array from this
1.807 - * method. Generally speaking, the array returned by this method will
1.808 - * contain one element for every frame that would be printed by
1.809 - * {@code printStackTrace}. Writes to the returned array do not
1.810 - * affect future calls to this method.
1.811 - *
1.812 - * @return an array of stack trace elements representing the stack trace
1.813 - * pertaining to this throwable.
1.814 - * @since 1.4
1.815 - */
1.816 - public StackTraceElement[] getStackTrace() {
1.817 - return getOurStackTrace().clone();
1.818 - }
1.819 -
1.820 - private synchronized StackTraceElement[] getOurStackTrace() {
1.821 - // Initialize stack trace field with information from
1.822 - // backtrace if this is the first call to this method
1.823 - if (stackTrace == UNASSIGNED_STACK ||
1.824 - (stackTrace == null && backtrace != null) /* Out of protocol state */) {
1.825 - int depth = getStackTraceDepth();
1.826 - stackTrace = new StackTraceElement[depth];
1.827 - for (int i=0; i < depth; i++)
1.828 - stackTrace[i] = getStackTraceElement(i);
1.829 - } else if (stackTrace == null) {
1.830 - return UNASSIGNED_STACK;
1.831 - }
1.832 - return stackTrace;
1.833 - }
1.834 -
1.835 - /**
1.836 - * Sets the stack trace elements that will be returned by
1.837 - * {@link #getStackTrace()} and printed by {@link #printStackTrace()}
1.838 - * and related methods.
1.839 - *
1.840 - * This method, which is designed for use by RPC frameworks and other
1.841 - * advanced systems, allows the client to override the default
1.842 - * stack trace that is either generated by {@link #fillInStackTrace()}
1.843 - * when a throwable is constructed or deserialized when a throwable is
1.844 - * read from a serialization stream.
1.845 - *
1.846 - * <p>If the stack trace of this {@code Throwable} {@linkplain
1.847 - * Throwable#Throwable(String, Throwable, boolean, boolean) is not
1.848 - * writable}, calling this method has no effect other than
1.849 - * validating its argument.
1.850 - *
1.851 - * @param stackTrace the stack trace elements to be associated with
1.852 - * this {@code Throwable}. The specified array is copied by this
1.853 - * call; changes in the specified array after the method invocation
1.854 - * returns will have no affect on this {@code Throwable}'s stack
1.855 - * trace.
1.856 - *
1.857 - * @throws NullPointerException if {@code stackTrace} is
1.858 - * {@code null} or if any of the elements of
1.859 - * {@code stackTrace} are {@code null}
1.860 - *
1.861 - * @since 1.4
1.862 - */
1.863 - public void setStackTrace(StackTraceElement[] stackTrace) {
1.864 - // Validate argument
1.865 - StackTraceElement[] defensiveCopy = stackTrace.clone();
1.866 - for (int i = 0; i < defensiveCopy.length; i++) {
1.867 - if (defensiveCopy[i] == null)
1.868 - throw new NullPointerException("stackTrace[" + i + "]");
1.869 - }
1.870 -
1.871 - synchronized (this) {
1.872 - if (this.stackTrace == null && // Immutable stack
1.873 - backtrace == null) // Test for out of protocol state
1.874 - return;
1.875 - this.stackTrace = defensiveCopy;
1.876 - }
1.877 - }
1.878 -
1.879 - /**
1.880 - * Returns the number of elements in the stack trace (or 0 if the stack
1.881 - * trace is unavailable).
1.882 - *
1.883 - * package-protection for use by SharedSecrets.
1.884 - */
1.885 - native int getStackTraceDepth();
1.886 -
1.887 - /**
1.888 - * Returns the specified element of the stack trace.
1.889 - *
1.890 - * package-protection for use by SharedSecrets.
1.891 - *
1.892 - * @param index index of the element to return.
1.893 - * @throws IndexOutOfBoundsException if {@code index < 0 ||
1.894 - * index >= getStackTraceDepth() }
1.895 - */
1.896 - native StackTraceElement getStackTraceElement(int index);
1.897 -
1.898 - /**
1.899 - * Reads a {@code Throwable} from a stream, enforcing
1.900 - * well-formedness constraints on fields. Null entries and
1.901 - * self-pointers are not allowed in the list of {@code
1.902 - * suppressedExceptions}. Null entries are not allowed for stack
1.903 - * trace elements. A null stack trace in the serial form results
1.904 - * in a zero-length stack element array. A single-element stack
1.905 - * trace whose entry is equal to {@code new StackTraceElement("",
1.906 - * "", null, Integer.MIN_VALUE)} results in a {@code null} {@code
1.907 - * stackTrace} field.
1.908 - *
1.909 - * Note that there are no constraints on the value the {@code
1.910 - * cause} field can hold; both {@code null} and {@code this} are
1.911 - * valid values for the field.
1.912 - */
1.913 -// private void readObject(ObjectInputStream s)
1.914 -// throws IOException, ClassNotFoundException {
1.915 -// s.defaultReadObject(); // read in all fields
1.916 -// if (suppressedExceptions != null) {
1.917 -// List<Throwable> suppressed = null;
1.918 -// if (suppressedExceptions.isEmpty()) {
1.919 -// // Use the sentinel for a zero-length list
1.920 -// suppressed = SUPPRESSED_SENTINEL;
1.921 -// } else { // Copy Throwables to new list
1.922 -// suppressed = new ArrayList<Throwable>(1);
1.923 -// for (Throwable t : suppressedExceptions) {
1.924 -// // Enforce constraints on suppressed exceptions in
1.925 -// // case of corrupt or malicious stream.
1.926 -// if (t == null)
1.927 -// throw new NullPointerException(NULL_CAUSE_MESSAGE);
1.928 -// if (t == this)
1.929 -// throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
1.930 -// suppressed.add(t);
1.931 -// }
1.932 -// }
1.933 -// suppressedExceptions = suppressed;
1.934 -// } // else a null suppressedExceptions field remains null
1.935 -//
1.936 -// /*
1.937 -// * For zero-length stack traces, use a clone of
1.938 -// * UNASSIGNED_STACK rather than UNASSIGNED_STACK itself to
1.939 -// * allow identity comparison against UNASSIGNED_STACK in
1.940 -// * getOurStackTrace. The identity of UNASSIGNED_STACK in
1.941 -// * stackTrace indicates to the getOurStackTrace method that
1.942 -// * the stackTrace needs to be constructed from the information
1.943 -// * in backtrace.
1.944 -// */
1.945 -// if (stackTrace != null) {
1.946 -// if (stackTrace.length == 0) {
1.947 -// stackTrace = UNASSIGNED_STACK.clone();
1.948 -// } else if (stackTrace.length == 1 &&
1.949 -// // Check for the marker of an immutable stack trace
1.950 -// SentinelHolder.STACK_TRACE_ELEMENT_SENTINEL.equals(stackTrace[0])) {
1.951 -// stackTrace = null;
1.952 -// } else { // Verify stack trace elements are non-null.
1.953 -// for(StackTraceElement ste : stackTrace) {
1.954 -// if (ste == null)
1.955 -// throw new NullPointerException("null StackTraceElement in serial stream. ");
1.956 -// }
1.957 -// }
1.958 -// } else {
1.959 -// // A null stackTrace field in the serial form can result
1.960 -// // from an exception serialized without that field in
1.961 -// // older JDK releases; treat such exceptions as having
1.962 -// // empty stack traces.
1.963 -// stackTrace = UNASSIGNED_STACK.clone();
1.964 -// }
1.965 -// }
1.966 -
1.967 - /**
1.968 - * Write a {@code Throwable} object to a stream.
1.969 - *
1.970 - * A {@code null} stack trace field is represented in the serial
1.971 - * form as a one-element array whose element is equal to {@code
1.972 - * new StackTraceElement("", "", null, Integer.MIN_VALUE)}.
1.973 - */
1.974 -// private synchronized void writeObject(ObjectOutputStream s)
1.975 -// throws IOException {
1.976 -// // Ensure that the stackTrace field is initialized to a
1.977 -// // non-null value, if appropriate. As of JDK 7, a null stack
1.978 -// // trace field is a valid value indicating the stack trace
1.979 -// // should not be set.
1.980 -// getOurStackTrace();
1.981 -//
1.982 -// StackTraceElement[] oldStackTrace = stackTrace;
1.983 -// try {
1.984 -// if (stackTrace == null)
1.985 -// stackTrace = SentinelHolder.STACK_TRACE_SENTINEL;
1.986 -// s.defaultWriteObject();
1.987 -// } finally {
1.988 -// stackTrace = oldStackTrace;
1.989 -// }
1.990 -// }
1.991 -
1.992 - /**
1.993 - * Appends the specified exception to the exceptions that were
1.994 - * suppressed in order to deliver this exception. This method is
1.995 - * thread-safe and typically called (automatically and implicitly)
1.996 - * by the {@code try}-with-resources statement.
1.997 - *
1.998 - * <p>The suppression behavior is enabled <em>unless</em> disabled
1.999 - * {@linkplain #Throwable(String, Throwable, boolean, boolean) via
1.1000 - * a constructor}. When suppression is disabled, this method does
1.1001 - * nothing other than to validate its argument.
1.1002 - *
1.1003 - * <p>Note that when one exception {@linkplain
1.1004 - * #initCause(Throwable) causes} another exception, the first
1.1005 - * exception is usually caught and then the second exception is
1.1006 - * thrown in response. In other words, there is a causal
1.1007 - * connection between the two exceptions.
1.1008 - *
1.1009 - * In contrast, there are situations where two independent
1.1010 - * exceptions can be thrown in sibling code blocks, in particular
1.1011 - * in the {@code try} block of a {@code try}-with-resources
1.1012 - * statement and the compiler-generated {@code finally} block
1.1013 - * which closes the resource.
1.1014 - *
1.1015 - * In these situations, only one of the thrown exceptions can be
1.1016 - * propagated. In the {@code try}-with-resources statement, when
1.1017 - * there are two such exceptions, the exception originating from
1.1018 - * the {@code try} block is propagated and the exception from the
1.1019 - * {@code finally} block is added to the list of exceptions
1.1020 - * suppressed by the exception from the {@code try} block. As an
1.1021 - * exception unwinds the stack, it can accumulate multiple
1.1022 - * suppressed exceptions.
1.1023 - *
1.1024 - * <p>An exception may have suppressed exceptions while also being
1.1025 - * caused by another exception. Whether or not an exception has a
1.1026 - * cause is semantically known at the time of its creation, unlike
1.1027 - * whether or not an exception will suppress other exceptions
1.1028 - * which is typically only determined after an exception is
1.1029 - * thrown.
1.1030 - *
1.1031 - * <p>Note that programmer written code is also able to take
1.1032 - * advantage of calling this method in situations where there are
1.1033 - * multiple sibling exceptions and only one can be propagated.
1.1034 - *
1.1035 - * @param exception the exception to be added to the list of
1.1036 - * suppressed exceptions
1.1037 - * @throws IllegalArgumentException if {@code exception} is this
1.1038 - * throwable; a throwable cannot suppress itself.
1.1039 - * @throws NullPointerException if {@code exception} is {@code null}
1.1040 - * @since 1.7
1.1041 - */
1.1042 - public final synchronized void addSuppressed(Throwable exception) {
1.1043 - if (exception == this)
1.1044 - throw new IllegalArgumentException(SELF_SUPPRESSION_MESSAGE);
1.1045 -
1.1046 - if (exception == null)
1.1047 - throw new NullPointerException(NULL_CAUSE_MESSAGE);
1.1048 -
1.1049 -// if (suppressedExceptions == null) // Suppressed exceptions not recorded
1.1050 -// return;
1.1051 -//
1.1052 -// if (suppressedExceptions == SUPPRESSED_SENTINEL)
1.1053 -// suppressedExceptions = new ArrayList<Throwable>(1);
1.1054 -//
1.1055 -// suppressedExceptions.add(exception);
1.1056 - }
1.1057 -
1.1058 - private static final Throwable[] EMPTY_THROWABLE_ARRAY = new Throwable[0];
1.1059 -
1.1060 - /**
1.1061 - * Returns an array containing all of the exceptions that were
1.1062 - * suppressed, typically by the {@code try}-with-resources
1.1063 - * statement, in order to deliver this exception.
1.1064 - *
1.1065 - * If no exceptions were suppressed or {@linkplain
1.1066 - * #Throwable(String, Throwable, boolean, boolean) suppression is
1.1067 - * disabled}, an empty array is returned. This method is
1.1068 - * thread-safe. Writes to the returned array do not affect future
1.1069 - * calls to this method.
1.1070 - *
1.1071 - * @return an array containing all of the exceptions that were
1.1072 - * suppressed to deliver this exception.
1.1073 - * @since 1.7
1.1074 - */
1.1075 - public final synchronized Throwable[] getSuppressed() {
1.1076 - return new Throwable[0];
1.1077 -// if (suppressedExceptions == SUPPRESSED_SENTINEL ||
1.1078 -// suppressedExceptions == null)
1.1079 -// return EMPTY_THROWABLE_ARRAY;
1.1080 -// else
1.1081 -// return suppressedExceptions.toArray(EMPTY_THROWABLE_ARRAY);
1.1082 - }
1.1083 -}