/****************************************************************************
 * Copyright (C) 2012-2018 ecsec GmbH.
 * All rights reserved.
 * Contact: ecsec GmbH (info@ecsec.de)
 *
 * This file is part of the Open eCard App.
 *
 * GNU General Public License Usage
 * This file may be used under the terms of the GNU General Public
 * License version 3.0 as published by the Free Software Foundation
 * and appearing in the file LICENSE.GPL included in the packaging of
 * this file. Please review the following information to ensure the
 * GNU General Public License version 3.0 requirements will be met:
 * http://www.gnu.org/copyleft/gpl.html.
 *
 * Other Usage
 * Alternatively, this file may be used in accordance with the terms
 * and conditions contained in a signed written agreement between
 * you and ecsec GmbH.
 *
 ***************************************************************************/

package org.openecard.common.apdu.exception;

import iso.std.iso_iec._24727.tech.schema.TransmitResponse;
import javax.annotation.Nullable;
import oasis.names.tc.dss._1_0.core.schema.Result;
import org.openecard.common.ECardException;
import org.openecard.common.apdu.common.CardResponseAPDU;


/**
 * @author Moritz Horsch
 */
public final class APDUException extends ECardException {

    private static final long serialVersionUID = 1L;

    private TransmitResponse transmitResponse;
    private CardResponseAPDU responseAPDU;

    /**
     * Creates a new APDUException.
     *
     * @param msg Message
     */
    public APDUException(String msg) {
	makeException(this, msg);
    }

    /**
     * Creates a new APDUException.
     *
     * @param minor Minor message
     * @param msg Message
     */
    public APDUException(String minor, String msg) {
	makeException(this, minor, msg);
    }

    /**
     * Creates a new APDUException.
     *
     * @param r Result
     */
    public APDUException(Result r) {
	makeException(this, r);
    }

    /**
     * Creates a new APDUException.
     *
     * @param cause Cause
     */
    public APDUException(Throwable cause) {
	makeException(this, cause);
    }

    /**
     * Creates a new APDUException.
     *
     * @param cause Cause
     * @param tr TransmitResponse
     */
    public APDUException(Throwable cause, TransmitResponse tr) {
	this(cause);

	transmitResponse = tr;
	if (! tr.getOutputAPDU().isEmpty()) {
	    responseAPDU = new CardResponseAPDU(tr);
	}
    }

    /**
     * Returns the TransmitResponse.
     *
     * @return TransmitResponseTransmitResponse
     */
    public TransmitResponse getTransmitResponse() {
	return transmitResponse;
    }

    /**
     * Returns the ResponseAPDU.
     *
     * @return ResponseAPDU
     */
    @Nullable
    public CardResponseAPDU getResponseAPDU() {
	return responseAPDU;
    }

}

@@ -1134,16 +1134,54 @@
 eption;%0A
+import org.openecard.common.WSHelper;%0A
 import o
@@ -2159,204 +2159,772 @@
   %7D%0A
-%0A    /**%0A     * Creates a new APDUException.%0A     *%0A     * @param cause Cause%0A     * @param tr TransmitResponse%0A     */%0A    public APDUException(Throwable cause, TransmitResponse tr) %7B%0A%09this(cause
+    %0A    /**%0A     * Creates a new APDUException.%0A     *%0A     * @param ex WSException%0A     */%0A    public APDUException(WSHelper.WSException ex) %7B%0A%09makeException(this, ex, ex.getResultMajor(), ex.getResultMinor(), ex.getResultMessage());%0A    %7D%0A%0A    /**%0A     * Creates a new APDUException.%0A     *%0A     * @param cause Cause%0A     * @param tr TransmitResponse%0A     */%0A    public APDUException(Throwable cause, TransmitResponse tr) %7B%0A%09this(cause);%0A%0A%09transmitResponse = tr;%0A%09if (! tr.getOutputAPDU().isEmpty()) %7B%0A%09    responseAPDU = new CardResponseAPDU(tr);%0A%09%7D%0A    %7D%0A%0A    /**%0A     * Creates a new APDUException.%0A     *%0A     * @param ex WSException%0A     * @param tr TransmitResponse%0A     */%0A    public APDUException(WSHelper.WSException ex, TransmitResponse tr) %7B%0A%09this(ex
 );%0A%0A

Add constructor with WSException as parameter