}
Apdu manualApdu;
protected Apdu makeManualApdu(boolean includeLc, boolean includeLe, boolean showErrorMessages) {
//try to make an apdu
Apdu out = null;
try {
String header = (String) apduHeaderTextField.getText();
header = header.replaceAll("\\s", "");
header = header.replaceAll("-", "");
Apdu apdu = new Apdu();
apdu.setHeader(header);
apdu.setLcData(CardReaderManagerView.this.lcDataEditor.getText().replaceAll("\\s", "").replaceAll("-", ""));
String le = CardReaderManagerView.this.leTextField.getText().replaceAll("\\s", "").replaceAll("-", "");
if (!le.isEmpty()) {
apdu.setExpectedLe(Integer.parseInt(le, 16));
}
out = apdu;
} catch (Throwable ex) {
if (showErrorMessages) {
String msg = "Cannot parse the APDU, action cancelled:\n" + ex;
JOptionPane.showMessageDialog(null, msg, "Incorrect input", JOptionPane.INFORMATION_MESSAGE);
}
}
manualApdu = out;
if (null == out) {
if (this.isActiveTerminalReady()) {
enableSendApduButtons(false);
}
this.sendApduButton.setToolTipText("APDU not recognized");
this.sendApduNoLeButton.setToolTipText("APDU not recognized");
this.sendApduNoLcButton.setToolTipText("APDU not recognized");
return out;
}
String toolTip = out.toString().replace("\n", "<br>");
toolTip = "<html>" + toolTip + "</html>";
this.sendApduButton.setToolTipText(toolTip);
Apdu outNoLe = out.clone();
outNoLe.setExpectedLe(0);
toolTip = outNoLe.toString().replace("\n", "<br>");
toolTip = "<html>" + toolTip + "</html>";
this.sendApduNoLeButton.setToolTipText(toolTip);
Apdu outNoLc = out.clone();
outNoLc.setLcData(new byte[0]);
toolTip = outNoLc.toString().replace("\n", "<br>");
toolTip = "<html>" + toolTip + "</html>";
this.sendApduNoLcButton.setToolTipText(toolTip);
if (this.isActiveTerminalReady()) {
enableSendApduButtons(true);
}