jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java
equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
73 } else { |
73 } else { |
74 card = null; |
74 card = null; |
75 } |
75 } |
76 } |
76 } |
77 try { |
77 try { |
78 card = new CardImpl(this, protocol); |
78 card = new CardImpl(this, protocol); |
79 return card; |
79 return card; |
80 } catch (PCSCException e) { |
80 } catch (PCSCException e) { |
81 if (e.code == SCARD_W_REMOVED_CARD) { |
81 if (e.code == SCARD_W_REMOVED_CARD || e.code == SCARD_E_NO_SMARTCARD) { |
82 throw new CardNotPresentException("No card present", e); |
82 throw new CardNotPresentException("No card present", e); |
83 } else { |
83 } else { |
84 throw new CardException("connect() failed", e); |
84 throw new CardException("connect() failed", e); |
85 } |
85 } |
86 } |
86 } |