6474807: (smartcardio) CardTerminal.connect() throws CardException instead of CardNotPresentException
authorigerasim
Tue, 30 Aug 2016 15:31:46 +0300
changeset 40678 6c488e65153f
parent 40677 8243adf9888e
child 40679 5378433ac23f
child 40730 0d19d6d18c0b
6474807: (smartcardio) CardTerminal.connect() throws CardException instead of CardNotPresentException Reviewed-by: valeriep
jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java
--- a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java	Tue Aug 30 14:16:16 2016 +0900
+++ b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java	Tue Aug 30 15:31:46 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,10 +75,10 @@
             }
         }
         try {
-            card =  new CardImpl(this, protocol);
+            card = new CardImpl(this, protocol);
             return card;
         } catch (PCSCException e) {
-            if (e.code == SCARD_W_REMOVED_CARD) {
+            if (e.code == SCARD_W_REMOVED_CARD || e.code == SCARD_E_NO_SMARTCARD) {
                 throw new CardNotPresentException("No card present", e);
             } else {
                 throw new CardException("connect() failed", e);