src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/Utils.java
branchhttp-client-branch
changeset 55821 fa0fc03c0853
parent 55818 725576a6821e
child 55924 edfab012adb3
equal deleted inserted replaced
55820:76d033c9908f 55821:fa0fc03c0853
    49 import java.util.Arrays;
    49 import java.util.Arrays;
    50 import java.util.Collection;
    50 import java.util.Collection;
    51 import java.util.List;
    51 import java.util.List;
    52 import java.util.Set;
    52 import java.util.Set;
    53 import java.util.concurrent.CompletionException;
    53 import java.util.concurrent.CompletionException;
       
    54 import java.util.concurrent.ExecutionException;
    54 import java.util.function.Predicate;
    55 import java.util.function.Predicate;
    55 import java.util.function.Supplier;
    56 import java.util.function.Supplier;
    56 import java.util.stream.Stream;
    57 import java.util.stream.Stream;
    57 
    58 
    58 import static java.util.stream.Collectors.joining;
    59 import static java.util.stream.Collectors.joining;
   102     public static ByteBuffer getBuffer() {
   103     public static ByteBuffer getBuffer() {
   103         return ByteBuffer.allocate(BUFSIZE);
   104         return ByteBuffer.allocate(BUFSIZE);
   104     }
   105     }
   105 
   106 
   106     public static Throwable getCompletionCause(Throwable x) {
   107     public static Throwable getCompletionCause(Throwable x) {
   107         if (!(x instanceof CompletionException)) return x;
   108         if (!(x instanceof CompletionException)
       
   109                 && !(x instanceof ExecutionException)) return x;
   108         final Throwable cause = x.getCause();
   110         final Throwable cause = x.getCause();
   109         return cause == null ? x : cause;
   111         return cause == null ? x : cause;
   110     }
   112     }
   111 
   113 
   112     public static IOException getIOException(Throwable t) {
   114     public static IOException getIOException(Throwable t) {