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

(smartcardio) CardPermission(String termName, String actions) violates specification

XMLWordPrintable

    • b132
    • generic
    • generic
    • Verified

      Problem description:
      ====================
      Specification for javax.smartcardio.CardPermission.CardPermission(String termName, String actions) states as follows:

      ---Quote from spec---
      Parameters:
      terminalName - the name of the card terminal, or *
      actions - the action string (or null if the set of permitted actions is empty)
      Throws:
      NullPointerException - if terminalName is null
      IllegalArgumentException - if actions is an invalid actions specification
      ---Quote from spec---

      So, spec is explicitly allows to pass null actions parameter to a constructor.
      But actually it throws an IllegalArgumentException in this case.


      Minimized test:
      ===============
      ---Test.java---

      import javax.smartcardio.*;

      public class Test {

          public static void main(String[] args) {
      CardPermission permission = new CardPermission("a", null);
      System.out.println("Cannot be reproduced - exception is not thrown");
          }

      }

      ---Test.java---


      Minimized test output:
      ======================
      [vs158239@vsmelov src]$ javac Test.java
      [vs158239@vsmelov src]$ java -cp ./ Test
      Exception in thread "main" java.lang.IllegalArgumentException: actions must not be empty
              at javax.smartcardio.CardPermission.getMask(CardPermission.java:133)
              at javax.smartcardio.CardPermission.<init>(CardPermission.java:128)
              at Test.main(Test.java:7)

            valeriep Valerie Peng
            vsmelovsunw Vladimir Smelov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: