Add constructor with WSException as parameter
@@ -26,6 +26,7 @@ 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.WSHelper;
import org.openecard.common.apdu.common.CardResponseAPDU;
@@ -76,6 +77,15 @@ public final class APDUException extends ECardException {
makeException(this, cause);
}
+ /**
+ * Creates a new APDUException.
+ *
+ * @param ex WSException
+ */
+ public APDUException(WSHelper.WSException ex) {
+ makeException(this, ex, ex.getResultMajor(), ex.getResultMinor(), ex.getResultMessage());
+ }
+
/**
* Creates a new APDUException.
*
@@ -91,6 +101,21 @@ public final class APDUException extends ECardException {
}
}
+ /**
+ * Creates a new APDUException.
+ *
+ * @param ex WSException
+ * @param tr TransmitResponse
+ */
+ public APDUException(WSHelper.WSException ex, TransmitResponse tr) {
+ this(ex);
+
+ transmitResponse = tr;
+ if (! tr.getOutputAPDU().isEmpty()) {
+ responseAPDU = new CardResponseAPDU(tr);
+ }
+ }
+
/**
* Returns the TransmitResponse.
*
