JDK-7047033 : (smartcardio) Card.disconnect(boolean reset) does not reset when reset is true
  • Type: Bug
  • Component: security-libs
  • Sub-Component: javax.smartcardio
  • Affected Version: 6
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-05-20
  • Updated: 2017-02-06
  • Resolved: 2014-05-28
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
7u72Fixed 8u20Fixed 9 b16Fixed
Related Reports
Relates :  
Relates :  
Sub Tasks
JDK-8144050 :  
(Submitted via Bugzilla)
Description From  Frank Cornelis   2010-04-12 03:28:37 PDT

The disconnect method of Card.java has a reset parameter which is used as
SCardDisconnect(cardId, (reset ? SCARD_LEAVE_CARD : SCARD_RESET_CARD));
So if reset is true, the card is not being reset, if false, the card is being
reset. Change the name of the variable, or fix the line of code?

The bug has label noreg-hard and escalation

For 9, notes for the compatibility guide should be created. (not necessarily release note). It'll help alert developers to behavioural changes introduced in JDK 9. JDK 8 example : http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html I think there's sufficient content in the 7u72 release note for docs teams to manage.

Added the suggested release notes, which cover this fix at https://bugs.openjdk.java.net/browse/JDK-8050495#comment-13559746

[~tviessma] I agree. Though, it might be better to document JDK-8049250 in the release notes, as it will provide the flag to switch to the old behavior.

IMO this change should be documented in the release notes. A backport to 6 is not needed I think.

Is not the fix going to break customers? Should we get this backported to JDK 6?

It's not clear from the API (both MS and pcsc-lite) if there is any noticeable difference in the state of the smartcard whether we disconnected from it with LEAVE of RESET argument. However, the fix itself is obviously correct: it just aligns the boolean reset argument with the RESET constant. Thus, I'm changing the label to noreg-hard.

Why there is no regression test?

Java Card TCK 3.0.4 and some other Java Card related projects use javax.smartcardio API and this method in particular. We use it to reset a card and it's important to us that reset works as expected. So it would be nice if this issue was resolved in near future.

EVALUATION javax.smartcardio.Card class has public abstract void disconnect(boolean reset) throws CardException; whose javadoc description specifies * @param reset whether to reset the card after disconnecting. However, the default implementation in sun.security.smartcardio.CardImpl class happens to act the opposite, i.e. if reset is true, the disconnect call doesn't reset the card and vice versa. Need to make the spec and behavior consistent.