/** * Try to attach a suppressed exception to a MessagingException in any order * that is possible. * @param required the exception expected to see as a reported failure. * @param optional the suppressed exception. * @return either the required or the optional exception. */ private static MessagingException attach( MessagingException required, Exception optional) { if (optional != null && !required.setNextException(optional)) { if (optional instanceof MessagingException) { final MessagingException head = (MessagingException) optional; if (head.setNextException(required)) { return head; } } if (optional != required) { required.addSuppressed(optional); } } return required; }
/** * Try to attach a suppressed exception to a MessagingException in any order * that is possible. * @param required the exception expected to see as a reported failure. * @param optional the suppressed exception. * @return either the required or the optional exception. */ private static MessagingException attach( MessagingException required, Exception optional) { if (optional != null && !required.setNextException(optional)) { if (optional instanceof MessagingException) { final MessagingException head = (MessagingException) optional; if (head.setNextException(required)) { return head; } } if (optional != required) { required.addSuppressed(optional); } } return required; }
/** * Try to attach a suppressed exception to a MessagingException in any order * that is possible. * @param required the exception expected to see as a reported failure. * @param optional the suppressed exception. * @return either the required or the optional exception. */ private static MessagingException attach( MessagingException required, Exception optional) { if (optional != null && !required.setNextException(optional)) { if (optional instanceof MessagingException) { final MessagingException head = (MessagingException) optional; if (head.setNextException(required)) { return head; } } if (optional != required) { required.addSuppressed(optional); } } return required; }
/** * Try to attach a suppressed exception to a MessagingException in any order * that is possible. * @param required the exception expected to see as a reported failure. * @param optional the suppressed exception. * @return either the required or the optional exception. */ private static MessagingException attach( MessagingException required, Exception optional) { if (optional != null && !required.setNextException(optional)) { if (optional instanceof MessagingException) { final MessagingException head = (MessagingException) optional; if (head.setNextException(required)) { return head; } } if (optional != required) { required.addSuppressed(optional); } } return required; }
/** * Try to attach a suppressed exception to a MessagingException in any order * that is possible. * @param required the exception expected to see as a reported failure. * @param optional the suppressed exception. * @return either the required or the optional exception. */ private static MessagingException attach( MessagingException required, Exception optional) { if (optional != null && !required.setNextException(optional)) { if (optional instanceof MessagingException) { final MessagingException head = (MessagingException) optional; if (head.setNextException(required)) { return head; } } if (optional != required) { required.addSuppressed(optional); } } return required; }