--- a/jdk/test/sun/security/smartcardio/TestPresent.java Thu Feb 11 11:19:03 2016 -0500
+++ b/jdk/test/sun/security/smartcardio/TestPresent.java Fri Feb 12 00:20:16 2016 +0300
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, 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
@@ -35,7 +35,7 @@
import javax.smartcardio.CardTerminal;
import javax.smartcardio.TerminalFactory;
-public class TestPresent {
+public class TestPresent extends Utils {
private static class Timer {
private long time = System.currentTimeMillis();
@@ -67,15 +67,12 @@
}
public static void main(String[] args) throws Exception {
- TerminalFactory factory = TerminalFactory.getInstance("PC/SC", null);
- System.out.println(factory);
-
- List<CardTerminal> terminals = factory.terminals().list();
- System.out.println("Terminals: " + terminals);
- if (terminals.isEmpty()) {
- throw new Exception("No card terminals available");
+ CardTerminal terminal = getTerminal(args);
+ if (terminal == null) {
+ System.out.println("Skipping the test: " +
+ "no card terminals available");
+ return;
}
- CardTerminal terminal = terminals.get(0);
while (terminal.isCardPresent()) {
System.out.println("*** Remove card!");