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 1
1
package com .dropbox .core ;
2
2
3
+ import javax .net .ssl .SSLHandshakeException ;
3
4
import java .io .IOException ;
5
+ import java .security .cert .CertPathValidatorException ;
4
6
5
7
/**
6
8
* This gets thrown when there's an {@link IOException} when reading or writing to the
@@ -14,7 +16,24 @@ public class NetworkIOException extends DbxException {
14
16
private static final long serialVersionUID = 0L ;
15
17
16
18
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 ;
18
37
}
19
38
20
39
@ Override
You can’t perform that action at this time.
0 commit comments