8169026: Handle smartcard clean up better

Reviewed-by: valeriep, ahgross
This commit is contained in:
Ivan Gerasimov 2016-11-17 22:01:02 +03:00
parent 2b71ce6a46
commit 1a21126223

View File

@ -270,7 +270,7 @@ final class CardImpl extends Card {
} }
public String toString() { public String toString() {
return "PC/SC card in " + terminal.getName() return "PC/SC card in " + terminal.name
+ ", protocol " + getProtocol() + ", state " + state; + ", protocol " + getProtocol() + ", state " + state;
} }
@ -278,6 +278,7 @@ final class CardImpl extends Card {
protected void finalize() throws Throwable { protected void finalize() throws Throwable {
try { try {
if (state == State.OK) { if (state == State.OK) {
state = State.DISCONNECTED;
SCardDisconnect(cardId, SCARD_LEAVE_CARD); SCardDisconnect(cardId, SCARD_LEAVE_CARD);
} }
} finally { } finally {