Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6425901

(smartcardio) RI's implementation of CardTerminal.getTerminalFactory() return null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 6
    • security-libs
    • None

      Problem description:
      ====================
      Sun's implementation of "PC/SC" smartcard reader I/O engine works wrong.
      RI implementation of "public TerminalFactory CardTerminal.getTerminalFactory()" returns null instead reference on factory used for CardTerminal creation.

      Please run the minimized test to reproduce failure.
      Issue appears on Windows XP with Gemplus "GemPCTwin" smart card reader for serial port.

      Minimized test:
      ===============

      --- test.java ---
      import javax.smartcardio.*;
      import java.security.*;
      import java.util.*;

      public class test {

          public static void main(String[] args) throws CardException,
              NoSuchAlgorithmException {
              
              TerminalFactory factory = TerminalFactory.getInstance("PC/SC", null);

              List<CardTerminal> cardTermList = factory.terminals();
          
              if( cardTermList.size() != 0) {
          
                  CardTerminal cardTerm = cardTermList.get(0);
          
                  TerminalFactory returned = cardTerm.getTerminalFactory();
          
                  if (returned == null) {
                      System.out.println("Failed. CardTerminal.getTerminalFactory() returns null.");
                      System.out.println("TerminalFactory object toString:" + factory.toString());
                      System.out.println("CardTerminal object toString:" + cardTerm.toString());
                  } else {
                      System.out.println("Passed.");
                  }
          
              } else {
                  System.out.println("Cannot be reproduced - card terminal (reader) absent.");
              }
          }
      }
      --- test.java ---

      Minimized test output:
      ======================
      D:\temp\CardTerminal>javac test.java

      D:\temp\CardTerminal>java -cp ./ test
      Failed. CardTerminal.getTerminalFactory() returns null.
      TerminalFactory object toString:TerminalFactory for type PC/SC from provider SunPCSC
      CardTerminal object toString:PC/SC terminal Gemplus Serial Smart Card Reader 0

      D:\temp\CardTerminal>java -version
      java version "1.6.0-beta2"
      Java(TM) SE Runtime Environment (build 1.6.0-beta2-b84)
      Java HotSpot(TM) Client VM (build 1.6.0-beta2-b84, mixed mode)

            andreas Andreas Sterbenz
            vsmelovsunw Vladimir Smelov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: