Files
calendar-lite/src/org/gingercal/DavException.java
T

33 lines
1.2 KiB
Java

package org.gingercal;
import java.io.IOException;
/** A server/protocol problem with a message that can be shown to the user as-is. */
public class DavException extends IOException {
public final int code;
/** code for redirect problems (forced HTTPS, loops); retrying another URL won't help. */
public static final int REDIRECT = -2;
public DavException(int code, String msg) {
super(msg);
this.code = code;
}
/** Thrown when the TLS certificate isn't trusted (or doesn't match the pin). */
public static class UntrustedCert extends IOException {
public final String fingerprint, subject, issuer, expires;
public final boolean pinMismatch;
public UntrustedCert(String fingerprint, String subject, String issuer, String expires,
boolean pinMismatch) {
super(pinMismatch ? L.t("Server certificate changed (does not match the pinned fingerprint)")
: L.t("Server certificate is not trusted by this phone"));
this.fingerprint = fingerprint;
this.subject = subject;
this.issuer = issuer;
this.expires = expires;
this.pinMismatch = pinMismatch;
}
}
}