[omemo] Cleanup CryptoFailedException

Remove the unused list of exceptions and add a (String, Exception)
constructor.
This commit is contained in:
Florian Schmaus 2021-03-12 22:19:55 +01:00
parent f9114f780d
commit 7cf0112487
1 changed files with 7 additions and 13 deletions

View File

@ -1,6 +1,6 @@
/**
*
* Copyright 2017 Paul Schaub
* Copyright 2017 Paul Schaub, 2021 Florian Schmaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,10 +16,6 @@
*/
package org.jivesoftware.smackx.omemo.exceptions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Exception gets thrown when some cryptographic function failed.
*
@ -27,20 +23,18 @@ import java.util.List;
*/
public class CryptoFailedException extends Exception {
private static final long serialVersionUID = 3466888654338119924L;
private static final long serialVersionUID = 1;
private final ArrayList<Exception> exceptions = new ArrayList<>();
public CryptoFailedException(String message, Exception wrappedException) {
super(message, wrappedException);
}
public CryptoFailedException(String message) {
super(message);
this(message, null);
}
public CryptoFailedException(Exception e) {
super(e);
exceptions.add(e);
this("Crypto failed " + e.getMessage(), e);
}
public List<Exception> getExceptions() {
return Collections.unmodifiableList(exceptions);
}
}