jdk/src/share/classes/java/lang/Throwable.java
changeset 7803 56bc97d69d93
parent 7186 7f5fe8985263
child 7988 d31b7cc371ef
equal deleted inserted replaced
7802:74f2ee2b62ba 7803:56bc97d69d93
   826             List<Throwable> suppressed = null;
   826             List<Throwable> suppressed = null;
   827             if (suppressedExceptions.isEmpty()) {
   827             if (suppressedExceptions.isEmpty()) {
   828                 // Use the sentinel for a zero-length list
   828                 // Use the sentinel for a zero-length list
   829                 suppressed = SUPPRESSED_SENTINEL;
   829                 suppressed = SUPPRESSED_SENTINEL;
   830             } else { // Copy Throwables to new list
   830             } else { // Copy Throwables to new list
   831                 suppressed = new ArrayList<Throwable>(1);
   831                 suppressed = new ArrayList<>(1);
   832                 for (Throwable t : suppressedExceptions) {
   832                 for (Throwable t : suppressedExceptions) {
   833                     // Enforce constraints on suppressed exceptions in
   833                     // Enforce constraints on suppressed exceptions in
   834                     // case of corrupt or malicious stream.
   834                     // case of corrupt or malicious stream.
   835                     if (t == null)
   835                     if (t == null)
   836                         throw new NullPointerException(NULL_CAUSE_MESSAGE);
   836                         throw new NullPointerException(NULL_CAUSE_MESSAGE);
   909 
   909 
   910             if (suppressedExceptions == null) // Suppressed exceptions not recorded
   910             if (suppressedExceptions == null) // Suppressed exceptions not recorded
   911                 return;
   911                 return;
   912 
   912 
   913             if (suppressedExceptions == SUPPRESSED_SENTINEL)
   913             if (suppressedExceptions == SUPPRESSED_SENTINEL)
   914                 suppressedExceptions = new ArrayList<Throwable>(1);
   914                 suppressedExceptions = new ArrayList<>(1);
   915 
   915 
   916             assert suppressedExceptions != SUPPRESSED_SENTINEL;
   916             assert suppressedExceptions != SUPPRESSED_SENTINEL;
   917 
   917 
   918             suppressedExceptions.add(exception);
   918             suppressedExceptions.add(exception);
   919         }
   919         }