Merge pull request #7415 from thunderbird/clean_up_CertificateValidationException
Remove unused code from `CertificateValidationException`
This commit is contained in:
commit
0d13561b22
2 changed files with 6 additions and 40 deletions
|
@ -16,6 +16,7 @@ import com.fsck.k9.backend.BackendManager;
|
|||
import com.fsck.k9.backend.api.Backend;
|
||||
import com.fsck.k9.mail.AuthType;
|
||||
import com.fsck.k9.mail.AuthenticationFailedException;
|
||||
import com.fsck.k9.mail.CertificateChainException;
|
||||
import com.fsck.k9.mail.CertificateValidationException;
|
||||
import com.fsck.k9.mail.ConnectionSecurity;
|
||||
import com.fsck.k9.mail.Flag;
|
||||
|
@ -355,7 +356,8 @@ public class MessagingControllerTest extends K9RobolectricTest {
|
|||
@Test
|
||||
public void sendPendingMessagesSynchronous_withCertificateFailure_shouldNotify() throws MessagingException {
|
||||
setupAccountWithMessageToSend();
|
||||
doThrow(new CertificateValidationException("Test")).when(backend).sendMessage(localMessageToSend1);
|
||||
doThrow(new CertificateValidationException("Test", new CertificateChainException("", null, null)))
|
||||
.when(backend).sendMessage(localMessageToSend1);
|
||||
|
||||
controller.sendPendingMessagesSynchronous(account);
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
package com.fsck.k9.mail;
|
||||
|
||||
import java.security.cert.CertPathValidatorException;
|
||||
|
@ -8,49 +7,14 @@ import java.security.cert.X509Certificate;
|
|||
import javax.net.ssl.SSLHandshakeException;
|
||||
|
||||
public class CertificateValidationException extends MessagingException {
|
||||
public static final long serialVersionUID = -1;
|
||||
private final Reason mReason;
|
||||
private X509Certificate[] mCertChain;
|
||||
private boolean mNeedsUserAttention = false;
|
||||
private String mAlias;
|
||||
|
||||
public enum Reason {
|
||||
Unknown, UseMessage, Expired, MissingCapability, RetrievalFailure
|
||||
}
|
||||
|
||||
public CertificateValidationException(String message) {
|
||||
this(message, Reason.UseMessage, null);
|
||||
}
|
||||
|
||||
public CertificateValidationException(Reason reason) {
|
||||
this(null, reason, null);
|
||||
}
|
||||
|
||||
public CertificateValidationException(String message, Reason reason, String alias) {
|
||||
super(message);
|
||||
/*
|
||||
* Instances created without a Throwable parameter as a cause are
|
||||
* presumed to need user attention.
|
||||
*/
|
||||
mNeedsUserAttention = true;
|
||||
mReason = reason;
|
||||
mAlias = alias;
|
||||
}
|
||||
|
||||
public CertificateValidationException(final String message, Throwable throwable) {
|
||||
super(message, throwable);
|
||||
mReason = Reason.Unknown;
|
||||
public CertificateValidationException(final String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
scanForCause();
|
||||
}
|
||||
|
||||
public String getAlias() {
|
||||
return mAlias;
|
||||
}
|
||||
|
||||
public Reason getReason() {
|
||||
return mReason;
|
||||
}
|
||||
|
||||
private void scanForCause() {
|
||||
Throwable throwable = getCause();
|
||||
|
||||
|
@ -117,7 +81,7 @@ public class CertificateValidationException extends MessagingException {
|
|||
* If the cause of this {@link CertificateValidationException} was a
|
||||
* {@link CertificateChainException}, then the offending chain is available
|
||||
* for return.
|
||||
*
|
||||
*
|
||||
* @return An {@link X509Certificate X509Certificate[]} containing the Cert.
|
||||
* chain, or else null.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue