File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
src/main/java/com/dropbox/core Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change 11package com .dropbox .core ;
22
3+ import javax .net .ssl .SSLHandshakeException ;
34import java .io .IOException ;
5+ import java .security .cert .CertPathValidatorException ;
46
57/**
68 * This gets thrown when there's an {@link IOException} when reading or writing to the
@@ -14,7 +16,24 @@ public class NetworkIOException extends DbxException {
1416 private static final long serialVersionUID = 0L ;
1517
1618 public NetworkIOException (IOException cause ) {
17- super (cause .getMessage (), cause );
19+ super (computeMessage (cause ), cause );
20+ }
21+
22+ private static String computeMessage (IOException ex ) {
23+ String message = ex .getMessage ();
24+
25+ // For CertPathValidationErrors, the CertPath is in the exception object but not
26+ // in the exception message. Pull it out into the message, because it would be
27+ // useful for debugging.
28+ if (ex instanceof SSLHandshakeException ) {
29+ Throwable innerCause = ex .getCause ();
30+ if (innerCause instanceof CertPathValidatorException ) {
31+ CertPathValidatorException cpve = (CertPathValidatorException ) innerCause ;
32+ message += "[CERT PATH: " + cpve .getCertPath () + "]" ;
33+ }
34+ }
35+
36+ return message ;
1837 }
1938
2039 @ Override
You can’t perform that action at this time.
0 commit comments