From 7cf0112487728cf24d93b831c6fa412d2969b6fc Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Fri, 12 Mar 2021 22:19:55 +0100 Subject: [PATCH] [omemo] Cleanup CryptoFailedException Remove the unused list of exceptions and add a (String, Exception) constructor. --- .../exceptions/CryptoFailedException.java | 20 +++++++------------ 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/exceptions/CryptoFailedException.java b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/exceptions/CryptoFailedException.java index 4e452af44..2b2978f50 100644 --- a/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/exceptions/CryptoFailedException.java +++ b/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/exceptions/CryptoFailedException.java @@ -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 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 getExceptions() { - return Collections.unmodifiableList(exceptions); - } }